182 std::unique_ptr<struct SysSemaphoreImpl> impl_;
bool detach(bool force=true)
Closes the semaphore handle and optionally removes it from the OS namespace.
bool is_attached() const
Returns true if the semaphore is currently attached to an OS name.
~SysSemaphore()
Destructor. Calls detach() if the semaphore is still attached.
static constexpr int kInfinite
Sentinel value for acquire() meaning "wait indefinitely".
定义 sys_semaphore.h:88
bool attach(const std::string &name)
Creates or opens a named semaphore with the given name.
bool acquire(size_t n=1, int timeout_ms=kInfinite)
Decrements the semaphore counter by n, blocking if necessary.
SysSemaphore(size_t count=0)
Constructs a SysSemaphore with the given initial count.
size_t get_count() const
Returns the current count of the semaphore.
void release(size_t n=1)
Increments the semaphore counter by n.
Platform-independent macro definitions for the VLink library.
#define VLINK_EXPORT
定义 macros.h:85
#define VLINK_DISALLOW_COPY_AND_ASSIGN(classname)
Deletes the copy constructor and copy-assignment operator of classname.
定义 macros.h:184