Files
Nim/tests/stdlib/tuserlocks.nim
ringabout 4fa86422c0 stdlib tests now check refc too (#21664)
* stdlib tests now check refc too

* typo

* fixes line numbers

* disable cpp

* do not touch
2023-04-21 15:37:58 +02:00

22 lines
271 B
Nim

discard """
matrix: "--mm:refc; --mm:orc"
"""
import std/rlocks
import std/assertions
var r: RLock
r.initRLock()
doAssert r.tryAcquire()
doAssert r.tryAcquire()
r.release()
r.release()
block:
var x = 12
withRLock r:
inc x
doAssert x == 13
r.deinitRLock()