mirror of
https://github.com/status-im/nim-chronos.git
synced 2025-01-31 13:35:11 +00:00
Add raises annotation to withTimeout callbacks (#168)
This commit is contained in:
parent
4abd7a5645
commit
c206d2bc19
@ -951,7 +951,9 @@ proc withTimeout*[T](fut: Future[T], timeout: Duration): Future[bool] =
|
||||
var timer: TimerCallback
|
||||
var cancelling = false
|
||||
|
||||
proc continuation(udata: pointer) {.gcsafe.} =
|
||||
# TODO: raises annotation shouldn't be needed, but likely similar issue as
|
||||
# https://github.com/nim-lang/Nim/issues/17369
|
||||
proc continuation(udata: pointer) {.gcsafe, raises: [Defect].} =
|
||||
if not(retFuture.finished()):
|
||||
if not(cancelling):
|
||||
if not(fut.finished()):
|
||||
@ -967,7 +969,9 @@ proc withTimeout*[T](fut: Future[T], timeout: Duration): Future[bool] =
|
||||
else:
|
||||
retFuture.complete(false)
|
||||
|
||||
proc cancellation(udata: pointer) {.gcsafe.} =
|
||||
# TODO: raises annotation shouldn't be needed, but likely similar issue as
|
||||
# https://github.com/nim-lang/Nim/issues/17369
|
||||
proc cancellation(udata: pointer) {.gcsafe, raises: [Defect].} =
|
||||
if not isNil(timer):
|
||||
clearTimer(timer)
|
||||
if not(fut.finished()):
|
||||
|
Loading…
x
Reference in New Issue
Block a user