diff options
author | andri lim <jangko128@gmail.com> | 2017-07-16 21:54:09 +0700 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-07-16 16:54:09 +0200 |
commit | 2ecdf582a86960462ed4b01afa1ded6484eaaa7b (patch) | |
tree | a5649419251600e457feb6826ce06979070e4adb /tests | |
parent | 4846ce0f4107746811da3f6a4b7b606ff1ba298d (diff) | |
download | Nim-2ecdf582a86960462ed4b01afa1ded6484eaaa7b.tar.gz |
fixes #6049 add mixin release, acquire to withLock (#6113)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stdlib/tlocks.nim | 10 | ||||
-rw-r--r-- | tests/stdlib/uselocks.nim | 11 |
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/stdlib/tlocks.nim b/tests/stdlib/tlocks.nim new file mode 100644 index 000000000..e567cfde8 --- /dev/null +++ b/tests/stdlib/tlocks.nim @@ -0,0 +1,10 @@ +discard """ + output: '''3''' + cmd: "nim $target --threads:on $options $file" +""" + +#bug #6049 +import uselocks + +var m = createMyType[int]() +echo $m.use() diff --git a/tests/stdlib/uselocks.nim b/tests/stdlib/uselocks.nim new file mode 100644 index 000000000..cde9641b2 --- /dev/null +++ b/tests/stdlib/uselocks.nim @@ -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 |