diff --git a/chronos/asyncmacro2.nim b/chronos/asyncmacro2.nim index 02703ea..2978ba5 100644 --- a/chronos/asyncmacro2.nim +++ b/chronos/asyncmacro2.nim @@ -30,7 +30,7 @@ template createCb(retFutureSym, iteratorNameSym, var nameIterVar = iteratorNameSym {.push stackTrace: off.} - proc identName(udata: pointer = nil) {.closure.} = + proc identName(udata: pointer = nil) {.closure, gcsafe.} = try: if not(nameIterVar.finished()): var next = nameIterVar() @@ -48,7 +48,7 @@ template createCb(retFutureSym, iteratorNameSym, else: {.gcsafe.}: {.push hint[ConvFromXtoItselfNotNeeded]: off.} - next.callback = CallbackFunc(identName) + next.callback = identName {.pop.} except CancelledError: retFutureSym.cancel() diff --git a/tests/testsync.nim b/tests/testsync.nim index 56c6a77..3f70885 100644 --- a/tests/testsync.nim +++ b/tests/testsync.nim @@ -11,8 +11,8 @@ import ../chronos when defined(nimHasUsed): {.used.} suite "Asynchronous sync primitives test suite": - var testLockResult = "" - var testEventResult = "" + var testLockResult {.threadvar.}: string + var testEventResult {.threadvar.}: string var testQueue1Result = 0 var testQueue2Result = 0 var testQueue3Result = 0