uselocks.nim 181 B

123456789101112
  1. import locks
  2. type MyType* [T] = object
  3. lock: Lock
  4. proc createMyType*[T]: MyType[T] =
  5. initLock(result.lock)
  6. proc use* (m: var MyType): int =
  7. withLock m.lock:
  8. result = 3