add explicit gcsafe annotations (fixes #174) (#175)

Seems like a variation of https://github.com/nim-lang/Nim/issues/17369
This commit is contained in:
Jacek Sieka 2021-04-03 10:05:08 +02:00 committed by GitHub
parent e5d3ecdd01
commit 895fc53193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
packageName = "chronos"
version = "3.0.0"
version = "3.0.1"
author = "Status Research & Development GmbH"
description = "Chronos"
license = "Apache License 2.0 or MIT"

View File

@ -621,7 +621,7 @@ proc `or`*[T, Y](fut1: Future[T], fut2: Future[Y]): Future[void] =
## If cancelled, ``fut1`` and ``fut2`` futures WILL NOT BE cancelled.
var retFuture = newFuture[void]("chronos.or")
var cb: proc(udata: pointer) {.gcsafe, raises: [Defect].}
cb = proc(udata: pointer) =
cb = proc(udata: pointer) {.gcsafe, raises: [Defect].} =
if not(retFuture.finished()):
var fut = cast[FutureBase](udata)
if cast[pointer](fut1) == udata:
@ -912,7 +912,7 @@ proc one*[T](futs: varargs[Future[T]]): Future[Future[T]] =
var nfuts = @futs
var cb: proc(udata: pointer) {.gcsafe, raises: [Defect].}
cb = proc(udata: pointer) =
cb = proc(udata: pointer) {.gcsafe, raises: [Defect].} =
if not(retFuture.finished()):
var res: Future[T]
var rfut = cast[FutureBase](udata)
@ -959,7 +959,7 @@ proc race*(futs: varargs[FutureBase]): Future[FutureBase] =
var nfuts = @futs
var cb: proc(udata: pointer) {.gcsafe, raises: [Defect].}
cb = proc(udata: pointer) =
cb = proc(udata: pointer) {.gcsafe, raises: [Defect].} =
if not(retFuture.finished()):
var res: FutureBase
var rfut = cast[FutureBase](udata)

View File

@ -900,7 +900,7 @@ proc stepsAsync*(number: int): Future[void] =
var counter = 0
var continuation: proc(data: pointer) {.gcsafe, raises: [Defect].}
continuation = proc(data: pointer) =
continuation = proc(data: pointer) {.gcsafe, raises: [Defect].} =
if not(retFuture.finished()):
inc(counter)
if counter < number:
@ -1033,7 +1033,7 @@ proc wait*[T](fut: Future[T], timeout = InfiniteDuration): Future[T] =
retFuture.fail(newException(AsyncTimeoutError, "Timeout exceeded!"))
var cancellation: proc(udata: pointer) {.gcsafe, raises: [Defect].}
cancellation = proc(udata: pointer) =
cancellation = proc(udata: pointer) {.gcsafe, raises: [Defect].} =
if not isNil(timer):
clearTimer(timer)
if not(fut.finished()):

View File

@ -27,7 +27,7 @@ when defined(chronosStrictException):
var nameIterVar = iteratorNameSym
{.push stackTrace: off.}
var identName: proc(udata: pointer) {.gcsafe, raises: [Defect].}
identName = proc(udata: pointer) {.raises: [Defect].} =
identName = proc(udata: pointer) {.gcsafe, raises: [Defect].} =
try:
# If the compiler complains about unlisted exception here, it's usually
# because you're calling a callback or forward declaration in your code
@ -64,7 +64,7 @@ else:
var nameIterVar = iteratorNameSym
{.push stackTrace: off.}
var identName: proc(udata: pointer) {.gcsafe, raises: [Defect].}
identName = proc(udata: pointer) {.raises: [Defect].} =
identName = proc(udata: pointer) {.gcsafe, raises: [Defect].} =
try:
# If the compiler complains about unlisted exception here, it's usually
# because you're calling a callback or forward declaration in your code

View File

@ -767,7 +767,7 @@ when defined(windows):
## Unix domain socket emulation with Windows Named Pipes.
var pipeHandle = INVALID_HANDLE_VALUE
var pipeContinuation: proc (udata: pointer) {.gcsafe, raises: [Defect].}
pipeContinuation = proc (udata: pointer) =
pipeContinuation = proc (udata: pointer) {.gcsafe, raises: [Defect].} =
# Continue only if `retFuture` is not cancelled.
if not(retFuture.finished()):
var pipeSuffix = $cast[cstring](unsafeAddr address.address_un[0])