Class anira::Semaphore

class Semaphore

Thin semaphore wrapper that mirrors the std::semaphore interface.

Backed either by std::binary_semaphore (modern platforms) or moodycamel::LightweightSemaphore (older Apple deployment targets), selected at compile time. Call sites use a single uniform API regardless of backend.

Public Functions

inline explicit Semaphore(int initial_count = 0)
inline void release()

Increment the counter and unblock a waiter (std::semaphore::release).

inline void acquire()

Block until the counter is positive, then decrement (std::semaphore::acquire).

inline bool try_acquire()

Try to decrement without blocking (std::semaphore::try_acquire).

inline bool try_acquire_until(std::chrono::steady_clock::time_point wait_until)

Try to decrement, blocking until at most wait_until (std::semaphore::try_acquire_until).