13using namespace MaxOS::common;
14using namespace MaxOS::processes;
15using namespace MaxOS::system;
16using namespace MaxOS::hardwarecommunication;
18Spinlock::Spinlock() =
default;
19Spinlock::~Spinlock() =
default;
63BlockingLock::BlockingLock() =
default;
64BlockingLock::~BlockingLock() =
default;
66bool BlockingLock::must_spin() {
110 thread->thread_state = ThreadState::WAITING;
116 if(
thread->thread_state == ThreadState::WAITING){
132 if(!m_queue.
empty()){
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.
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.
iterator push_back(Type)
Adds an element to the end of the vector and returns the iterator of the element.
Type pop_front()
Removes the m_first_memory_chunk element from the Vector.
bool empty() const
Checks if the Vector is empty.
static void ForceInterruptReturn(system::cpu_status_t *state)
Force the CPU to return from an interrupt (see interrupts.s)
static Scheduler * core_scheduler()
Gets the scheduler for the currently executing core.
static Thread * get_thread(uint64_t tid)
Gets a thread on the currently executing core by its TID.
static bool is_active()
Checks if the global scheduler is active.
static Thread * current_thread()
Gets the thread on the currently executing core.
struct PACKED MaxOS::system::CPUStatus cpu_status_t
Alias for CPUStatus struct.
Defines a GlobalScheduler and Scheduler for managing processes and threads.
Defines Spinlock and BlockingLock classes for thread synchronization.
constexpr uint8_t BLOCKING_FAST_TRY_LIMIT
How many attempts to acquire the lock should fail before queueing.