2015-11-21 07:36:48 +00:00
|
|
|
struct Scheduler {
|
2016-02-09 11:51:12 +00:00
|
|
|
enum class Mode : uint {
|
|
|
|
Run,
|
|
|
|
SynchronizeCPU,
|
|
|
|
SynchronizeAll,
|
|
|
|
};
|
2011-01-07 11:11:56 +00:00
|
|
|
|
2016-02-09 11:51:12 +00:00
|
|
|
enum class Event : uint {
|
|
|
|
Unknown,
|
|
|
|
Step,
|
|
|
|
Frame,
|
|
|
|
Synchronize,
|
|
|
|
};
|
2010-12-28 06:03:02 +00:00
|
|
|
|
2016-02-09 11:51:12 +00:00
|
|
|
auto power() -> void;
|
|
|
|
auto enter(Mode = Mode::Run) -> Event;
|
|
|
|
auto exit(Event) -> void;
|
|
|
|
auto synchronize(cothread_t) -> void;
|
|
|
|
auto synchronize() -> void;
|
|
|
|
auto synchronizing() const -> bool;
|
|
|
|
|
|
|
|
private:
|
|
|
|
cothread_t host = nullptr;
|
|
|
|
cothread_t resume = nullptr;
|
|
|
|
Mode mode = Mode::Run;
|
|
|
|
Event event = Event::Unknown;
|
2010-12-28 06:03:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern Scheduler scheduler;
|