diff --git a/chronos.nimble b/chronos.nimble index e3077a0..04543c2 100644 --- a/chronos.nimble +++ b/chronos.nimble @@ -1,5 +1,5 @@ packageName = "chronos" -version = "2.3.4" +version = "2.3.5" author = "Status Research & Development GmbH" description = "Chronos" license = "Apache License 2.0 or MIT" diff --git a/chronos/asyncfutures2.nim b/chronos/asyncfutures2.nim index 4624e2a..16d1b73 100644 --- a/chronos/asyncfutures2.nim +++ b/chronos/asyncfutures2.nim @@ -482,13 +482,12 @@ proc `and`*[T, Y](fut1: Future[T], fut2: Future[Y]): Future[void] {. fut1.callback = cb fut2.callback = cb - proc cancel(udata: pointer) {.gcsafe.} = + proc cancellation(udata: pointer) {.gcsafe.} = # On cancel we remove all our callbacks only. - if not(retFuture.finished()): - fut1.removeCallback(cb) - fut2.removeCallback(cb) + fut1.removeCallback(cb) + fut2.removeCallback(cb) - retFuture.cancelCallback = cancel + retFuture.cancelCallback = cancellation return retFuture proc `or`*[T, Y](fut1: Future[T], fut2: Future[Y]): Future[void] {. @@ -510,13 +509,12 @@ proc `or`*[T, Y](fut1: Future[T], fut2: Future[Y]): Future[void] {. fut1.callback = cb fut2.callback = cb - proc cancel(udata: pointer) {.gcsafe.} = + proc cancellation(udata: pointer) {.gcsafe.} = # On cancel we remove all our callbacks only. - if not(retFuture.finished()): - fut1.removeCallback(cb) - fut2.removeCallback(cb) + fut1.removeCallback(cb) + fut2.removeCallback(cb) - retFuture.cancelCallback = cancel + retFuture.cancelCallback = cancellation return retFuture proc all*[T](futs: varargs[Future[T]]): auto {. @@ -688,17 +686,16 @@ proc allFutures*[T](futs: varargs[Future[T]]): Future[void] = if completedFutures == totalFutures: retFuture.complete() - proc cancel(udata: pointer) {.gcsafe.} = + proc cancellation(udata: pointer) {.gcsafe.} = # On cancel we remove all our callbacks only. - if not(retFuture.finished()): - for i in 0..