Implement timeouts on mutexes.

Still need to set timeoutPtr after they expire.
Pretty sure I did this the right way, seems CoreTiming does already
allow/use multiple events for the same type?
This commit is contained in:
Unknown W. Brackets committed 2012-11-20 02:20:13 -08:00
1 parent b9bb5c4cce
commit d88fa153b7
5 files changed
+143 -54

No files matched your search

+37
View File
@@ -249,6 +249,43 @@ void ScheduleEvent(int cyclesIntoFuture, int event_type, u64 userdata)
AddEventToQueue(ne);
}
void UnscheduleEvent(int event_type, u64 userdata)
{
if (!first)
return;
while(first)
{
if (first->type == event_type && first->userdata == userdata)
{
Event *next = first->next;
FreeEvent(first);
first = next;
}
else
{
break;
}
}
if (!first)
return;
Event *prev = first;
Event *ptr = prev->next;
while (ptr)
{
if (ptr->type == event_type && ptr->userdata == userdata)
{
prev->next = ptr->next;
FreeEvent(ptr);
ptr = prev->next;
}
else
{
prev = ptr;
ptr = ptr->next;
}
}
}
void RegisterAdvanceCallback(void (*callback)(int cyclesExecuted))
{
advanceCallback = callback;