This commit is contained in:
Niklas Gollenstede
2025-10-31 22:37:36 +01:00
commit 174fe17e89
197 changed files with 79558 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
// vim: set noet ts=4 sw=4:
#include "dispatcher.h"
#include "../arch/core.h"
#include "../debug/output.h" // IWYU pragma: keep
Dispatcher::Dispatcher() : life(nullptr) {}
Thread *Dispatcher::active() const { return life; }
void Dispatcher::go(Thread *first) {
assert(active() == nullptr);
setActive(first);
first->go();
}
void Dispatcher::dispatch(Thread *next) {
Thread *current = active();
assert(current != nullptr);
if (current != next) {
setActive(next);
current->resume(next);
}
}