Skip to content

Commit

Permalink
make SomeFuture public
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomrsantos committed Aug 29, 2024
1 parent c04576d commit d6a1f8a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion chronos/internal/asyncfutures.nim
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type
FutureCompletedError* = object of FutureError
## Error raised when trying access the error of a completed Future

SomeFuture = Future|InternalRaisesFuture
SomeFuture* = Future|InternalRaisesFuture

func raiseFuturePendingError(fut: FutureBase) {.
noinline, noreturn, raises: FuturePendingError.} =
Expand Down Expand Up @@ -1241,6 +1241,15 @@ proc one*[F: SomeFuture](futs: openArray[F]): Future[F] {.

oneImpl

proc oneCancel*[F: SomeFuture](futs: varargs[F]): Future[F] {.
async: (raw: true, raises: [ValueError, CancelledError]).} =
try:
await one(futs)
finally:
for f in futs:
if not f.completed:
await f.cancelAndWait()

template raceImpl =
# If one of the Future[T] already finished we return it as result
for fut in futs:
Expand Down

0 comments on commit d6a1f8a

Please sign in to comment.