folly::LifoSemImpl

Concrete LIFO semaphore parameterized by its baton and atomic types.

Synopsis

Declared in <folly/synchronization/LifoSem.h>

template<
    template<
    typename,
    typename> typename Atom = atomic,
    class BatonType = SaturatingSemaphore<true, Atom>>
struct LifoSemImpl;

Types

NameDescription
Options Currently unused, only for compatibility with ThrottledLifoSem.

Type Aliases

NameDescription
Options Configuration options carried over from the base semaphore.

Member Functions

NameDescription
operator= [deleted]Assignment operator
isShutdown Returns true iff shutdown() has been called
post post overloads
shutdown Prevents blocking on this semaphore, causing all blocking wait() calls to throw ShutdownSemError. Both currently blocked wait() and future calls to wait() for which tryWait() would return false will cause an exception. Calls to wait() for which the matching post() has already occurred will proceed normally.
tryPost Returns true on a successful handoff, and return false without changing the value of the semaphore if there are no waiters
tryWait tryWait overloads
try_wait
try_wait_for
try_wait_until
valueGuess Returns a guess at the current value, designed for debugging. If there are no concurrent posters or waiters then this will be correct
wait Blocks the current thread until there is a matching post or the semaphore is shut down. Throws ShutdownSemError if the semaphore has been shut down and this method would otherwise be blocking. Note that wait() doesn't throw during shutdown if tryWait() would return true

Using Declarations

Name
Unnamed using

Protected Type Aliases

NameDescription
UniquePtr The type of a std::unique_ptr that will automatically return a LifoSemNode to the appropriate IndexedMemPool

Protected Enums

Name
WaitResult

Protected Member Functions

NameDescription
allocateNode Returns a node that can be passed to decrOrLink
tryRemoveNode
tryWaitOrPush Returns DECR if the semaphore value was decremented (and waiterNode was untouched), PUSH if a reference to the wait node was pushed, or SHUTDOWN if decrement was not possible and push wasn't allowed because isShutdown(). Ownership of the wait node remains the responsibility of the caller, who must not release it until after the node's Handoff has been posted.