File: scheduler.cpp

package info (click to toggle)
libretro-bsnes-mercury 094%2Bgit20160126-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,632 kB
  • sloc: cpp: 109,056; ansic: 3,097; makefile: 638; xml: 11; sh: 1
file content (32 lines) | stat: -rw-r--r-- 537 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#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);
}

void Scheduler::debug() {
  exit(ExitReason::DebuggerEvent);
}

void Scheduler::init() {
  host_thread = co_active();
  thread = cpu.thread;
  sync = SynchronizeMode::None;
}

Scheduler::Scheduler() {
  host_thread = nullptr;
  thread = nullptr;
  exit_reason = ExitReason::UnknownEvent;
}

#endif