Fiber-compatible semaphore base. Will safely block fibers that wait when no tokens are available and wake fibers when signalled.
Declared in <folly/fibers/SemaphoreBase.h>
class SemaphoreBase;
| Name | Description |
|---|---|
Waiter | A queued waiter blocked until the semaphore has capacity. |
| Name | Description |
|---|---|
SemaphoreBase [constructor] | Constructors |
operator= | Assignment operators |
getAvailableTokens | Returns the number of tokens currently available. |
getCapacity | Returns the total number of tokens the semaphore can hold. |
| Name | Description |
|---|---|
WaiterList | List of waiters queued for capacity. |
| Name | Description |
|---|---|
co_wait_common | Wait for request capacity in the semaphore. |
future_wait_common | Wait for request capacity in the semaphore, returning a future. |
signalSlow | Slow path that wakes queued waiters when tokens become available. |
try_wait_common | try_wait_common overloads |
waitSlow | Slow path that enqueues the waiter when tokens are unavailable. |
wait_common | Wait for request capacity in the semaphore. |
| Name | Description |
|---|---|
capacity_ | Total number of tokens the semaphore can hold. |
tokens_ | Atomic counter of currently available tokens. |
waitList_ | Synchronized queue of pending waiters. |
| Name | Description |
|---|---|
BatchSemaphore | Fiber-compatible batch semaphore with ability to perform batch token increment/decrement. Will safely block fibers that wait when no tokens are available and wake fibers when signalled. |