9#ifndef MAXOS_COMMON_SPINLOCK_H
10#define MAXOS_COMMON_SPINLOCK_H
15namespace MaxOS::common {
24 bool m_locked =
false;
52 bool m_locked =
false;
55 static bool must_spin();
Enables a resource to be used by only one instance at a time through a combination of spinning and qu...
void acquire()
Acquire the spinlock, spin until the lock is available and sleeping the thread until marked as availa...
void lock()
Lock the spinlock once it is available, sleeping until other processes are done with it.
void release()
Mark as unlocked, wake the next enqueued thread.
void unlock()
Unlock the spinlock.
bool is_locked() const
Check if the spinlock is locked.
Stores the left, top, width and height of a rectangle.
Enables a resource to be used by only one instance at a time through locking and unlocking.
void lock()
Lock the spinlock once it is available.
void release()
Release the spinlock.
void unlock()
Unlock the spinlock.
bool is_locked() const
Check if the spinlock is locked.
void acquire()
Acquire the spinlock: wait until the lock is available, spinning until that happens.
constexpr uint8_t BLOCKING_FAST_TRY_LIMIT
How many attempts to acquire the lock should fail before queueing.
Defines a Vector class for dynamically storing an array of elements.