2016-02-09 11:51:12 +00:00
|
|
|
struct Scheduler {
|
|
|
|
enum class Mode : uint {
|
|
|
|
Run,
|
|
|
|
SynchronizeCPU,
|
|
|
|
SynchronizeAll,
|
|
|
|
};
|
2012-03-19 11:19:53 +00:00
|
|
|
|
2016-02-09 11:51:12 +00:00
|
|
|
enum class Event : uint {
|
|
|
|
Unknown,
|
|
|
|
Frame,
|
|
|
|
Synchronize,
|
|
|
|
};
|
2012-03-19 11:19:53 +00:00
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto power() -> void;
|
2016-02-09 11:51:12 +00:00
|
|
|
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;
|
2012-03-19 11:19:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern Scheduler scheduler;
|