13#ifndef NSBACI_SERVICES_RUNTIME_NSBACI_SCHEDULER_H
14#define NSBACI_SERVICES_RUNTIME_NSBACI_SCHEDULER_H
33class NsbaciScheduler final :
public Scheduler {
35 NsbaciScheduler() =
default;
36 ~NsbaciScheduler()
override =
default;
43 void unblock(nsbaci::types::ThreadID threadId)
override;
44 void yield()
override;
48 void clear()
override;
50 const std::vector<Thread>&
getThreads()
const override;
60 std::optional<size_t> findThreadIndex(nsbaci::types::ThreadID threadId)
const;
void terminateCurrent() override
Terminate the currently running thread.
Definition nsbaciScheduler.cpp:130
void unblock(nsbaci::types::ThreadID threadId) override
Move a thread from blocked to ready state.
Definition nsbaciScheduler.cpp:107
void clear() override
Clear all threads and reset scheduler state.
Definition nsbaciScheduler.cpp:156
void blockOnCoend(int32_t expectedThreads) override
Block current thread on coend (waiting for spawned threads).
Definition nsbaciScheduler.cpp:189
void blockCurrent() override
Block the currently running thread.
Definition nsbaciScheduler.cpp:64
size_t unblockSemaphore(uint32_t semaphoreAddr) override
Unblock threads waiting on a semaphore.
Definition nsbaciScheduler.cpp:86
void yield() override
Yield the current thread (move to back of ready queue).
Definition nsbaciScheduler.cpp:119
void unblockIO() override
Move all I/O waiting threads back to ready queue.
Definition nsbaciScheduler.cpp:166
const std::vector< Thread > & getThreads() const override
Get all threads managed by the scheduler.
Definition nsbaciScheduler.cpp:175
Thread * pickNext() override
Pick the next thread to run.
Definition nsbaciScheduler.cpp:16
void blockOnSemaphore(uint32_t semaphoreAddr) override
Block current thread on a semaphore.
Definition nsbaciScheduler.cpp:75
Thread * current() override
Get the currently running thread.
Definition nsbaciScheduler.cpp:149
bool hasThreads() const override
Check if there are any threads left to run.
Definition nsbaciScheduler.cpp:144
void checkCoendUnblock() override
Check if coend-blocked threads should be unblocked.
Definition nsbaciScheduler.cpp:200
void addThread(Thread thread) override
Add a new thread to the scheduler.
Definition nsbaciScheduler.cpp:57
Represents a thread in the runtime service.
Definition thread.h:31
Runtime services namespace for nsbaci.
Scheduler class declaration for nsbaci runtime service.