mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-08 00:23:10 +00:00
manual count
This commit is contained in:
parent
185f1248e2
commit
8a222430a6
@ -109,4 +109,18 @@ suite "Share buffer test":
|
|||||||
b.release()
|
b.release()
|
||||||
check intref[] == 0
|
check intref[] == 0
|
||||||
|
|
||||||
|
test "test manual release / decr":
|
||||||
|
echo "\nintref setup:\n"
|
||||||
|
let intref: ref int = new(ref int)
|
||||||
|
intref[] = 40
|
||||||
|
var b = newSharedPtr(unsafeIsolate TestObjGen[int](val: intref), manualCount = 2)
|
||||||
|
try:
|
||||||
|
echo "a[]: ", b[]
|
||||||
|
check b[].val[] == 40
|
||||||
|
finally:
|
||||||
|
b.decr()
|
||||||
|
check intref[] == 40
|
||||||
|
b.release()
|
||||||
|
check intref[] == 0
|
||||||
|
|
||||||
# TODO: add async test
|
# TODO: add async test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user