mirror of
https://github.com/status-im/nim-chronos.git
synced 2025-02-12 11:16:52 +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 timer: TimerCallback
|
||||||
var cancelling = false
|
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(retFuture.finished()):
|
||||||
if not(cancelling):
|
if not(cancelling):
|
||||||
if not(fut.finished()):
|
if not(fut.finished()):
|
||||||
@ -967,7 +969,9 @@ proc withTimeout*[T](fut: Future[T], timeout: Duration): Future[bool] =
|
|||||||
else:
|
else:
|
||||||
retFuture.complete(false)
|
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):
|
if not isNil(timer):
|
||||||
clearTimer(timer)
|
clearTimer(timer)
|
||||||
if not(fut.finished()):
|
if not(fut.finished()):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user