From 3212ce1ff016ba7e859e83f7eb4cdfa5c18adf80 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Tue, 12 Sep 2023 17:38:21 -0700 Subject: [PATCH] testing finalizers --- datastore/threadproxyds.nim | 1 - datastore/threads/threadsignalpool.nim | 4 +++- tests/datastore/testthreadproxyds.nim | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/datastore/threadproxyds.nim b/datastore/threadproxyds.nim index ffd8b02..17365e1 100644 --- a/datastore/threadproxyds.nim +++ b/datastore/threadproxyds.nim @@ -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) diff --git a/datastore/threads/threadsignalpool.nim b/datastore/threads/threadsignalpool.nim index 158fd23..4f68242 100644 --- a/datastore/threads/threadsignalpool.nim +++ b/datastore/threads/threadsignalpool.nim @@ -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) diff --git a/tests/datastore/testthreadproxyds.nim b/tests/datastore/testthreadproxyds.nim index 074e808..ad922bb 100644 --- a/tests/datastore/testthreadproxyds.nim +++ b/tests/datastore/testthreadproxyds.nim @@ -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