10#ifndef STK_SYNC_SPINLOCK_H_
11#define STK_SYNC_SPINLOCK_H_
156 __stk_full_memfence();
192 __stk_full_memfence();
#define STK_KERNEL_PANIC(id)
Called when the kernel detects an unrecoverable internal fault.
Contains interface definitions of the library.
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
Namespace of STK package.
TId GetTid()
Get task/thread Id of the calling task.
const TId TID_NONE
Reserved task/thread id representing zero/none 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.