Fiber‐compatible semaphore base. Will safely block fibers that wait when no tokens are available and wake fibers when signalled.
Synopsis
Declared in <folly/fibers/SemaphoreBase.h>
class SemaphoreBase;
Types
Name |
Description |
A queued waiter blocked until the semaphore has capacity. |
Member Functions
Name |
Description |
|
Constructors |
Assignment operators |
|
Returns the number of tokens currently available. |
|
Returns the total number of tokens the semaphore can hold. |
Protected Type Aliases
Name |
Description |
List of waiters queued for capacity. |
Protected Member Functions
Name |
Description |
Wait for request capacity in the semaphore. |
|
Wait for request capacity in the semaphore, returning a future. |
|
Slow path that wakes queued waiters when tokens become available. |
|
|
|
Slow path that enqueues the waiter when tokens are unavailable. |
|
Wait for request capacity in the semaphore. |
Protected Data Members
Name |
Description |
Total number of tokens the semaphore can hold. |
|
Atomic counter of currently available tokens. |
|
Synchronized queue of pending waiters. |
Derived Classes
Name |
Description |
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. |
Created with MrDocs