Fiber‐compatible semaphore. Will safely block fibers that wait when no tokens are available and wake fibers when signalled.
Synopsis
Declared in <folly/fibers/Semaphore.h>
class Semaphore;
Description
Fair. Waiters are awoken in FIFO order. (Note: whether the callers see FIFO order depends on the executors, wrapping async types, and the existence of happens‐before relationships between async wait operations.)
Types
Name |
Description |
A queued waiter that is notified when the semaphore acquires capacity. |
Member Functions
Name |
Description |
|
Constructors |
Assignment operators |
|
Wait for capacity in the semaphore with a timeout. |
|
Wait for capacity in the semaphore. |
|
Wait for capacity in the semaphore. |
|
Return the number of tokens currently available. |
|
Return the total number of tokens the semaphore was created with. |
|
Release a token in the semaphore. Signal the waiter if necessary. |
|
|
|
Wait for capacity in the semaphore. |
Created with MrDocs