12 #ifndef ROC_CORE_SEMAPHORE_H_
13 #define ROC_CORE_SEMAPHORE_H_
15 #include <mach/semaphore.h>
#define ROC_ATTR_NODISCARD
Emit warning if function result is not checked.
Base class for non-copyable objects.
Semaphore(unsigned counter=0)
Initialize semaphore with given counter.
ROC_ATTR_NODISCARD bool timed_wait(nanoseconds_t deadline)
Wait until the counter becomes non-zero, decrement it, and return true. If deadline expires before th...
void wait()
Wait until the counter becomes non-zero, decrement it, and return.
void post()
Increment counter and wake up blocked waits. This method is lock-free.
int64_t nanoseconds_t
Nanoseconds.