testing finalizers

This commit is contained in:
Jaremy Creechley 2023-09-12 17:38:21 -07:00
parent cf891184a9
commit 3212ce1ff0
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
3 changed files with 5 additions and 3 deletions

View File

@ -100,7 +100,6 @@ method put*(
block:
var fa: FutureAlloc
fa.new(faFinalizer)
echo "FA NEW! ", cast[pointer](fa).repr
let (ret, reallysignal) = await newThreadResult(void)

View File

@ -103,9 +103,11 @@ proc `decr`*(x: SharedSignalPtr) =
else:
echo "SIGNAL: decr: ", repr x.buf.pointer, " ", x.cnt[]
import std/strutils
proc `=destroy`*(x: var SharedSignalPtr) =
echo "SIGNAL: destroy: ", repr x.buf.pointer, " ", x.cnt.repr
echo "SIGNAL: destroy:st: ", $getStackTrace()
echo "SIGNAL: destroy:st: ", ($getStackTrace()).split("\n").join(";")
decr(x)

View File

@ -32,10 +32,11 @@ proc testThreadProxy() =
data = "value for 1".toBytes()
test "check put":
for i in 1..2:
for i in 1..20:
echo "\n\n=== put ==="
let res1 = await sds.put(key1, data)
check res1.isOk
GC_fullCollect()
# GC_fullCollect()
# print "res1: ", res1