asynchronous.tasks

Support for tasks, coroutines and the scheduler.

Members

Classes

GeneratorTask
class GeneratorTask(T)

A $(D_PSYMBOL GeneratorTask) is a $(D_PSYMBOL Task) that periodically returns values of type $(D_PSYMBOL T) to the caller via $(D_PSYMBOL yieldValue). This is represented as an $(D_PSYMBOL InputRange).

Task
class Task(Coroutine, Args...)

Schedule the execution of a fiber: wrap it in a future. A task is a subclass of Future.

TaskRepository
class TaskRepository
Undocumented in source.

Enums

ReturnWhen
enum ReturnWhen
Undocumented in source.

Functions

asCompleted
auto asCompleted(EventLoop eventLoop, FutureHandle[] futures, Duration timeout)

Return a generator whose values, when waited for, are Future instances in the order they complete.

ensureFuture
auto ensureFuture(EventLoop eventLoop, Coroutine coroutine, Args args)

Schedule the execution of a coroutine: wrap it in a future. Return a $(D_PSYMBOL Task) object.

shield
auto shield(EventLoop eventLoop, Coroutine coroutine, Args args)

Wait for a future, shielding it from cancellation.

sleep
auto sleep(EventLoop eventLoop, Duration delay, Result result)

Create a coroutine that completes after a given time. If $(D_PSYMBOL result) is provided, it is produced to the caller when the coroutine completes.

wait
auto wait(EventLoop eventLoop, Future[] futures, Duration timeout, ReturnWhen returnWhen)

Wait for the Future instances given by $(PARAM futures) to complete.

waitFor
auto waitFor(EventLoop eventLoop, Future future, Duration timeout)

Wait for the single Future to complete with timeout. If timeout is 0 or negative, block until the future completes.

yieldValue
void yieldValue(T value)

Yield a value to the caller of the currently executing generator task. The type of the yielded value and the type of the generator must be the same.

Interfaces

TaskHandle
interface TaskHandle
Undocumented in source.

Meta

License

Boost Software License - Version 1.0

Authors

Dragos Carp