10#ifndef STK_SYNC_SPINLOCK_H_
11#define STK_SYNC_SPINLOCK_H_
161 __stk_full_memfence();
173 bool success =
false;
201 __stk_full_memfence();
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
#define STK_VIRT_DTOR
Makes destructors virtual and compliant to strict rules if STK_STRICT_COMPLIANCY=0.
Contains helper implementations which simplify user-side code.
Namespace of STK package.
static __stk_forceinline void STK_KERNEL_PANIC(stk::EKernelPanicId id)
Called when the kernel detects an unrecoverable internal fault.
static TId GetTid()
Get task/thread Id of the calling task.
static constexpr TId TID_NONE
Reserved task/thread id representing zero/none thread id.
Word TId
Task (thread) id.
@ KERNEL_PANIC_ASSERT
Internal assertion failed (maps from STK_ASSERT).
bool IsInsideISR()
Check whether the CPU is currently executing inside a hardware interrupt service routine (ISR).
Synchronization primitives for task coordination and resource protection.
Atomic busy-wait lock used as the global cross-core synchronisation primitive inside CriticalSection.
Interface for mutex synchronization primitive.
static const uint16_t RECURSION_MAX
maximum nesting depth
STK_NONCOPYABLE_CLASS(SpinLock)
void Unlock()
Release the lock or decrement the recursion counter.
uint16_t m_recursion_count
nesting depth
hw::SpinLock m_lock
low-level spin lock
bool LockRecursively(TId locking_tid)
TId m_owner_tid
thread id of the current owner
bool TryLock()
Attempt to acquire the lock without blocking.
void MakeLocked(TId locking_tid)
void Lock()
Acquire the lock.
SpinLock()
Construct a SpinLock in the unlocked state.
STK_VIRT_DTOR ~SpinLock()
Destructor.