2010-08-09 13:28:56 +00:00
|
|
|
#ifdef SYSTEM_CPP
|
|
|
|
|
|
|
|
Scheduler scheduler;
|
|
|
|
|
|
|
|
void Scheduler::enter() {
|
|
|
|
host_thread = co_active();
|
|
|
|
co_switch(thread);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scheduler::exit(ExitReason reason) {
|
|
|
|
exit_reason = reason;
|
|
|
|
thread = co_active();
|
|
|
|
co_switch(host_thread);
|
|
|
|
}
|
|
|
|
|
2012-02-09 12:53:55 +00:00
|
|
|
void Scheduler::debug() {
|
|
|
|
exit(ExitReason::DebuggerEvent);
|
|
|
|
}
|
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
void Scheduler::init() {
|
|
|
|
host_thread = co_active();
|
|
|
|
thread = cpu.thread;
|
|
|
|
sync = SynchronizeMode::None;
|
|
|
|
}
|
|
|
|
|
|
|
|
Scheduler::Scheduler() {
|
|
|
|
host_thread = 0;
|
|
|
|
thread = 0;
|
|
|
|
exit_reason = ExitReason::UnknownEvent;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|