struct Coprocessor : Thread { alwaysinline void step(unsigned clocks); alwaysinline void synchronize_cpu(); }; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void Coprocessor::step(unsigned clocks) { clock += clocks * (uint64)cpu.frequency; } void Coprocessor::synchronize_cpu() { if(clock >= 0 && scheduler.sync != Scheduler::SynchronizeMode::All) co_switch(cpu.thread); }