mirror of
https://github.com/status-im/nim-chronos.git
synced 2025-01-18 23:31:13 +00:00
Removed unnecessary checks.
This commit is contained in:
parent
c43d572ad6
commit
0f7f616133
@ -188,12 +188,11 @@ proc fail*[T](future: Future[T], error: ref Exception) =
|
|||||||
future.callbacks.call()
|
future.callbacks.call()
|
||||||
|
|
||||||
proc clearCallbacks(future: FutureBase) =
|
proc clearCallbacks(future: FutureBase) =
|
||||||
if len(future.callbacks) > 0:
|
# ZAH: This could have been a single call to `setLen`
|
||||||
# ZAH: This could have been a single call to `setLen`
|
var count = len(future.callbacks)
|
||||||
var count = len(future.callbacks)
|
while count > 0:
|
||||||
while count > 0:
|
discard future.callbacks.popFirst()
|
||||||
discard future.callbacks.popFirst()
|
dec(count)
|
||||||
dec(count)
|
|
||||||
|
|
||||||
proc addCallback*(future: FutureBase, cb: CallbackFunc, udata: pointer = nil) =
|
proc addCallback*(future: FutureBase, cb: CallbackFunc, udata: pointer = nil) =
|
||||||
## Adds the callbacks proc to be called when the future completes.
|
## Adds the callbacks proc to be called when the future completes.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user