Preliminary. ThinkMeta ConcurrentTasks and this documentation are preliminary; everything is subject to change.

API reference / Synchronization

SemaphoreLock class

Scope guard that holds one permit of a semaphore.

Use
import ThinkMeta.ConcurrentTasks.Synchronization.Semaphore;
Namespace
ThinkMeta::ConcurrentTasks::Synchronization

Syntax

template <SemaphoreType _SemaphoreType>
class [[nodiscard("Discarding a lock guard immediately releases the lock.")]]
    SemaphoreLock

Template parameters

_SemaphoreTypeSemaphoreType
The semaphore type: Semaphore or Semaphore_s.

Remarks

Semaphore::Wait on construction (may suspend the calling task), Semaphore::Release of one permit on destruction. Task or converted thread only.

See also

SpinSemaphoreLock

Constructors

SemaphoreLock

Takes one permit (Semaphore::Wait).

Syntax

explicit SemaphoreLock(_SemaphoreType& semaphore) noexcept;

Parameters

semaphore_SemaphoreType&
The semaphore; it must outlive the guard.

~SemaphoreLock

Releases the permit.

Syntax

~SemaphoreLock() noexcept;

Generated from ThinkMeta.ConcurrentTasks.API @ 137ec1d (2026-10-17).