verifying types

This commit is contained in:
Jaremy Creechley 2023-09-13 14:29:41 -07:00
parent d769b8720c
commit 2a85265e15
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
3 changed files with 12 additions and 4 deletions

View File

@ -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,

View File

@ -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:

View File

@ -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":