diff options
author | Konstantin Molchanov <kmolchanov@machinezone.com> | 2016-05-31 15:32:30 +0400 |
---|---|---|
committer | Konstantin Molchanov <kmolchanov@machinezone.com> | 2016-05-31 15:32:30 +0400 |
commit | 6e8053853ba58ffd21b562e2054f6604733a5142 (patch) | |
tree | 4e9c26645b6c09ac39e15a7f9b4d895ac12ba6e5 /lib | |
parent | 5a007a84fc8350a3a43ddc712c7a59a9ab2dce79 (diff) | |
download | Nim-6e8053853ba58ffd21b562e2054f6604733a5142.tar.gz |
stdlib: asyncdispatch: `add` proc supports varargs now.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/asyncdispatch.nim | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim index 53c78d929..2d34749a9 100644 --- a/lib/pure/asyncdispatch.nim +++ b/lib/pure/asyncdispatch.nim @@ -355,7 +355,7 @@ proc `or`*[T, Y](fut1: Future[T], fut2: Future[Y]): Future[void] = fut2.callback = cb return retFuture -proc all*[A](futs: openarray[Future[A]]): Future[seq[A]] = +proc all*[T](futs: varargs[Future[T]]): Future[seq[T]] = ## Returns a future which will complete once all futures in ``futs`` ## complete. ## @@ -364,12 +364,12 @@ proc all*[A](futs: openarray[Future[A]]): Future[seq[A]] = var retFuture = newFuture[seq[A]]("asyncdispatch.all") - retValues = newSeq[A](len(futs)) + retValues = newSeq[T](len(futs)) completedFutures = 0 for i, fut in futs: proc setCallback(i: int) = - fut.callback = proc(f: Future[A]) = + fut.callback = proc(f: Future[T]) = retValues[i] = f.read() inc(completedFutures) @@ -380,9 +380,6 @@ proc all*[A](futs: openarray[Future[A]]): Future[seq[A]] = return retFuture -proc all*[A](futs: varargs[Future[A]]): Future[seq[A]] = - return all(@futs) - type PDispatcherBase = ref object of RootRef timers: HeapQueue[tuple[finishAt: float, fut: Future[void]]] |