CoreTiming: Merge ScheduleEvent variants into one function

Now Core::IsCPUThread() only gets called once when using the AnyThread
variant. Also, I think the enum approach makes calling code clearer.
This commit is contained in:
JosJuice
2016-07-07 15:52:08 +02:00
parent 088f7eaa3d
commit 3443a10030
15 changed files with 99 additions and 94 deletions

View File

@ -48,10 +48,18 @@ void DoState(PointerWrap& p);
int RegisterEvent(const std::string& name, TimedCallback callback);
void UnregisterAllEvents();
enum class FromThread
{
CPU,
NON_CPU,
// Don't use ANY unless you're sure you need to call from
// both the CPU thread and at least one other thread
ANY
};
// userdata MAY NOT CONTAIN POINTERS. userdata might get written and reloaded from savestates.
void ScheduleEvent(s64 cyclesIntoFuture, int event_type, u64 userdata = 0);
void ScheduleEvent_Threadsafe(s64 cyclesIntoFuture, int event_type, u64 userdata = 0);
void ScheduleEvent_AnyThread(s64 cyclesIntoFuture, int event_type, u64 userdata = 0);
void ScheduleEvent(s64 cycles_into_future, int event_type, u64 userdata = 0,
FromThread from = FromThread::CPU);
// We only permit one event of each type in the queue at a time.
void RemoveEvent(int event_type);