mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 21:40:32 +00:00
Stdlib: asyncdispatch: all proc: Fix incorect counter value issue.
This commit is contained in:
@@ -368,12 +368,15 @@ proc all*[A](futs: openarray[Future[A]]): Future[seq[A]] =
|
||||
completedFutures = 0
|
||||
|
||||
for i, fut in futs:
|
||||
fut.callback = proc(f: Future[A]) =
|
||||
retValues[i] = f.read()
|
||||
inc(completedFutures)
|
||||
proc setCallback(i: int) =
|
||||
fut.callback = proc(f: Future[A]) =
|
||||
retValues[i] = f.read()
|
||||
inc(completedFutures)
|
||||
|
||||
if completedFutures == len(futs):
|
||||
retFuture.complete(retValues)
|
||||
if completedFutures == len(retValues):
|
||||
retFuture.complete(retValues)
|
||||
|
||||
setCallback(i)
|
||||
|
||||
return retFuture
|
||||
|
||||
|
||||
Reference in New Issue
Block a user