// This is to be called when outside threads, such as the graphics thread, wants to // schedule things to be executed on the main thread. void ScheduleEvent_Threadsafe(s64 cyclesIntoFuture, int event_type, u64 userdata) { std::lock_guard<std::recursive_mutex> lk(externalEventSection); Event *ne = GetNewTsEvent(); ne->time = globalTimer + cyclesIntoFuture; ne->type = event_type; ne->next = 0; ne->userdata = userdata; if(!tsFirst) tsFirst = ne; if(tsLast) tsLast->next = ne; tsLast = ne; }
// This is to be called when outside threads, such as the graphics thread, wants to // schedule things to be executed on the main thread. void ScheduleEvent_Threadsafe(s64 cycles_into_future, int event_type, u64 userdata) { std::lock_guard<std::recursive_mutex> lock(external_event_section); Event* new_event = GetNewTsEvent(); new_event->time = GetTicks() + cycles_into_future; new_event->type = event_type; new_event->next = nullptr; new_event->userdata = userdata; if (!ts_first) ts_first = new_event; if (ts_last) ts_last->next = new_event; ts_last = new_event; has_ts_events = true; }
// This is to be called when outside threads, such as the graphics thread, wants to // schedule things to be executed on the main thread. void ScheduleEvent_Threadsafe(s64 cyclesIntoFuture, int event_type, u64 userdata) { std::lock_guard<std::recursive_mutex> lk(externalEventSection); Event *ne = GetNewTsEvent(); ne->time = GetTicks() + cyclesIntoFuture; ne->type = event_type; ne->next = 0; ne->userdata = userdata; if(!tsFirst) tsFirst = ne; if(tsLast) tsLast->next = ne; tsLast = ne; Common::AtomicStoreRelease(hasTsEvents, 1); }