HH\Awaitable
An Awaitable
value represents a value that is fetched
asynchronously, such as a database access
Awaitable
values are
usually returned by async
functions.
Use await
to wait for a single Awaitable
value. If you have
multiple Awaitable
s and you want to wait for all of them
together, use concurrent
or helper functions like
Vec\map_async
.
Awaitable
is not multithreading. Hack is single threaded, so
Awaitable
allows you to wait for multiple external results at
once, rather than sequentially.
Interface Synopsis
namespace HH;
abstract class Awaitable {...}
Public Methods
::setOnIOWaitEnterCallback(mixed $callback): void
Set callback for when the scheduler enters I/O wait::setOnIOWaitExitCallback(mixed $callback): void
Set callback for when the scheduler exits I/O wait::setOnJoinCallback(mixed $callback): void
Set callback for when \HH\Asio\join() is called->getName(): string
Get name of the operation behind this wait handle->isFailed(): bool
Check if this wait handle failed->isFinished(): bool
Check if this wait handle finished (succeeded or failed)->isSucceeded(): bool
Check if this wait handle succeeded