RAII‐style semaphore lock

Synopsis

Declared in <semaphore_grant.h>

template<std::ptrdiff_t LeastMaxValue = std::counting_semaphore<>::max()>
class CountingSemaphoreGrant;

Member Functions

Name

Description

CountingSemaphoreGrant [constructor]

Constructors

~CountingSemaphoreGrant [destructor]

Releases the held slot, if any, on destruction.

operator=

Assignment operators

Acquire

Acquires the semaphore, blocking until a slot is available.

Release

Releases the held semaphore slot, if any.

TryAcquire

Attempts to acquire the semaphore without blocking.

operator bool

Reports whether this grant currently holds a semaphore slot.

Created with MrDocs