try_wait overloads
Synopses
Declared in <folly/fibers/Semaphore.h>
If the semaphore has capacity, removes a token and returns true. Otherwise returns false and leaves the semaphore unchanged.
bool
try_wait();
Try to wait on the semaphore. Return true on success. On failure, the passed waiter is enqueued, its baton will be posted once semaphore has capacity. Caller is responsible to wait then signal.
bool
try_wait(Waiter& waiter);
Return Value
-
true if a token was acquired, false otherwise.
-
true if a token was acquired immediately, false otherwise.
Parameters
Name |
Description |
waiter |
The waiter enqueued when no token is immediately available. |
Created with MrDocs