mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-10 17:43:13 +00:00
verifying types
This commit is contained in:
parent
d769b8720c
commit
2a85265e15
@ -185,8 +185,10 @@ method close*(
|
||||
if self.tds[].tp != nil:
|
||||
## this can block... how to handle? maybe just leak?
|
||||
self.tds[].tp.shutdown()
|
||||
self[].tds[].tp = nil # ensure our sharedptr doesn't try and dealloc
|
||||
|
||||
self[].tds[].ds = nil # ensure our sharedptr doesn't try and dealloc
|
||||
# self.tds.release()
|
||||
|
||||
proc newThreadProxyDatastore*(
|
||||
ds: Datastore,
|
||||
|
||||
@ -62,6 +62,8 @@ proc decr*[T](x: var SharedPtr[T]) =
|
||||
when compiles(`=destroy`(x[])):
|
||||
echoed "SharedPtr:call:child:destructor: ", $(typeof(x[]))
|
||||
`=destroy`(x[])
|
||||
else:
|
||||
echoed "SharedPtr:NOT CALLED:child:destructor: ", $(typeof(x[]))
|
||||
deallocShared(x.container)
|
||||
x.container = nil
|
||||
else:
|
||||
|
||||
@ -29,20 +29,24 @@ proc threadTest() =
|
||||
sds = newThreadProxyDatastore(mem).expect("should work")
|
||||
key1 = Key.init("/a").tryGet
|
||||
data = "value for 1".toBytes()
|
||||
|
||||
teardownAll:
|
||||
let res = await sds.close()
|
||||
res.get()
|
||||
|
||||
test "check put":
|
||||
# echo "\n\n=== put ==="
|
||||
let res1 = await sds.put(key1, data)
|
||||
check res1.isOk
|
||||
print "res1: ", res1
|
||||
GC_fullCollect()
|
||||
# GC_fullCollect()
|
||||
|
||||
proc main9) =
|
||||
proc main() =
|
||||
threadTest()
|
||||
GC_fullCollect()
|
||||
# GC_fullCollect()
|
||||
|
||||
main()
|
||||
GC_fullCollect()
|
||||
# GC_fullCollect()
|
||||
|
||||
|
||||
# test "check get":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user