mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 08:54:53 +00:00
* stdlib tests now check refc too * typo * fixes line numbers * disable cpp * do not touch
22 lines
271 B
Nim
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()
|