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

API reference / Synchronization

SpinCriticalSectionLock class

Scope guard that holds a critical section, spinning before it suspends.

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

Syntax

template <CriticalSectionType _CriticalSectionType>
class [[nodiscard("Discarding a lock guard immediately releases the lock.")]]
    SpinCriticalSectionLock

Template parameters

_CriticalSectionTypeCriticalSectionType
The critical section type: CriticalSection or CriticalSection_s.

Remarks

Up to spinCount CriticalSection::TryEnter attempts (with YieldProcessor in between, the thread is not given up), then a suspending CriticalSection::Enter. CriticalSection::Leave on destruction. Task or converted thread only.

See also

CriticalSectionLock

Constructors

SpinCriticalSectionLock

Enters the critical section, spinning first.

Syntax

explicit SpinCriticalSectionLock(
    _CriticalSectionType& criticalSection,
    unsigned long spinCount
) noexcept;

Parameters

criticalSection_CriticalSectionType&
The critical section; it must outlive the guard.
spinCountunsigned long
The maximum number of spin attempts (0: CriticalSection::Enter at once).

~SpinCriticalSectionLock

Leaves the critical section.

Syntax

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