parent
4846ce0f41
commit
2ecdf582a8
3 changed files with 22 additions and 0 deletions
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue