Files
Nim/tests/stdlib/uselocks.nim
2024-11-23 22:01:39 +01:00

18 lines
277 B
Nim

import locks
import std/assertions
type MyType* [T] = object
lock: Lock
proc createMyType*[T]: MyType[T] =
result = default(MyType[T])
initLock(result.lock)
proc use* (m: var MyType): int =
withLock m.lock:
result = 3
block:
var l: Lock
doAssert $l == "()"