mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-29 19:57:58 +00:00
11
tests/stdlib/uselocks.nim
Normal file
11
tests/stdlib/uselocks.nim
Normal file
@@ -0,0 +1,11 @@
|
||||
import locks
|
||||
|
||||
type MyType* [T] = object
|
||||
lock: Lock
|
||||
|
||||
proc createMyType*[T]: MyType[T] =
|
||||
initLock(result.lock)
|
||||
|
||||
proc use* (m: var MyType): int =
|
||||
withLock m.lock:
|
||||
result = 3
|
||||
Reference in New Issue
Block a user