// 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); } }