9#ifndef MAXOS_PROCESSES_BLOCK_H
10#define MAXOS_PROCESSES_BLOCK_H
12#include <libcommon/vector.h>
14namespace MaxOS::processes {
31 bool m_locked =
false;
32 common::Vector<uint64_t> m_queue;
34 static bool must_spin();
constexpr uint8_t BLOCKING_FAST_TRY_LIMIT
How many attempts to acquire the lock should fail before queueing.
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.