mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
@@ -28,6 +28,11 @@ type
|
||||
|
||||
{.push stackTrace: off.}
|
||||
|
||||
|
||||
proc `$`*(lock: Lock): string =
|
||||
# workaround bug #14873
|
||||
result = "()"
|
||||
|
||||
proc initLock*(lock: var Lock) {.inline.} =
|
||||
## Initializes the given lock.
|
||||
when not defined(js):
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
discard """
|
||||
output: '''3'''
|
||||
cmd: "nim $target --threads:on $options $file"
|
||||
targets: "c cpp js"
|
||||
matrix: "--threads:on"
|
||||
"""
|
||||
|
||||
#bug #6049
|
||||
import uselocks
|
||||
|
||||
var m = createMyType[int]()
|
||||
echo $m.use()
|
||||
doAssert m.use() == 3
|
||||
|
||||
@@ -9,3 +9,7 @@ proc createMyType*[T]: MyType[T] =
|
||||
proc use* (m: var MyType): int =
|
||||
withLock m.lock:
|
||||
result = 3
|
||||
|
||||
block:
|
||||
var l: Lock
|
||||
doAssert $l == "()"
|
||||
|
||||
Reference in New Issue
Block a user