folly::fibers::SemaphoreBase::co_wait_common

Wait for request capacity in the semaphore.

Synopsis

Declared in <folly/fibers/SemaphoreBase.h>

coro::Task<void>
co_wait_common(int64_t tokens);

Description

Note that this wait-operation can be cancelled by requesting cancellation on the awaiting coroutine's associated CancellationToken. If the operation is successfully cancelled then it will complete with an error of type folly::OperationCancelled.

Note that requesting cancellation of the operation will only have an effect if the operation does not complete synchronously (ie. was not already in a signalled state).

If the semaphore was already in a signalled state prior to awaiting the returned Task then the operation will complete successfully regardless of whether cancellation was requested.

Return Value

A coroutine task that completes once the tokens are acquired.

Parameters

NameDescription
tokensNumber of tokens to acquire.