Use addCallback rather than callback= in asyncfutures.all() (#6850)

* Use addCallback rather than callback= in asyncfutures.all()

Addresses part of #6849

* Stop using do notation for #6849

* Update example style
This commit is contained in:
Mathias Stearn 2017-12-08 19:55:04 -05:00 • committed by Dominik Picheta
commit b87ef65532
3 changed files with 22 additions and 4 deletions

View file

@ -333,7 +333,7 @@ proc all*[T](futs: varargs[Future[T]]): auto =
let totalFutures = len(futs)
for fut in futs:
fut.callback = proc(f: Future[T]) =
fut.addCallback proc (f: Future[T]) =
inc(completedFutures)
if not retFuture.finished:
if f.failed:
@ -355,7 +355,7 @@ proc all*[T](futs: varargs[Future[T]]): auto =
for i, fut in futs:
proc setCallback(i: int) =
fut.callback = proc(f: Future[T]) =
fut.addCallback proc (f: Future[T]) =
inc(completedFutures)
if not retFuture.finished:
if f.failed: