#pragma once //license: GPLv3 //started: 2010-12-27 #include #include #include #include #include namespace GameBoy { using File = Emulator::File; using Scheduler = Emulator::Scheduler; using Cheat = Emulator::Cheat; extern Scheduler scheduler; extern Cheat cheat; struct Thread : Emulator::Thread { auto create(auto (*entrypoint)() -> void, double frequency, bool resetClock) -> void; auto synchronize(Thread& thread) -> void; }; #include #include #include #include #include #include inline auto Thread::create(auto (*entrypoint)() -> void, double frequency, bool resetClock = true) -> void { Emulator::Thread::create(entrypoint, frequency, resetClock); scheduler.append(*this); } inline auto Thread::synchronize(Thread& thread) -> void { if(_clock > thread._clock) scheduler.resume(thread); } } #include