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.")]]
SpinCriticalSectionLockTemplate parameters
_CriticalSectionTypeCriticalSectionType- The critical section type:
CriticalSectionorCriticalSection_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
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::Enterat once).
~SpinCriticalSectionLock
Generated from ThinkMeta.ConcurrentTasks.API @ 137ec1d (2026-10-17).