Don't allow two drawsyncs to be in play at once.
This commit is contained in:
parent
210c7b1639
commit
6190918158
3 changed files with 49 additions and 0 deletions
|
@ -315,6 +315,52 @@ s64 UnscheduleEvent(int event_type, u64 userdata)
|
|||
return result;
|
||||
}
|
||||
|
||||
s64 UnscheduleThreadsafeEvent(int event_type, u64 userdata)
|
||||
{
|
||||
s64 result = 0;
|
||||
std::lock_guard<std::recursive_mutex> lk(externalEventSection);
|
||||
if (!tsFirst)
|
||||
return result;
|
||||
while(tsFirst)
|
||||
{
|
||||
if (tsFirst->type == event_type && tsFirst->userdata == userdata)
|
||||
{
|
||||
result = tsFirst->time - globalTimer;
|
||||
|
||||
Event *next = tsFirst->next;
|
||||
FreeTsEvent(tsFirst);
|
||||
tsFirst = next;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!tsFirst)
|
||||
return result;
|
||||
|
||||
Event *prev = tsFirst;
|
||||
Event *ptr = prev->next;
|
||||
while (ptr)
|
||||
{
|
||||
if (ptr->type == event_type && ptr->userdata == userdata)
|
||||
{
|
||||
result = ptr->time - globalTimer;
|
||||
|
||||
prev->next = ptr->next;
|
||||
FreeTsEvent(ptr);
|
||||
ptr = prev->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
prev = ptr;
|
||||
ptr = ptr->next;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Warning: not included in save state.
|
||||
void RegisterAdvanceCallback(void (*callback)(int cyclesExecuted))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue