I add a CriticalSection in RemoveThreadsafeEvent for safety
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5992 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a72339b086
commit
25accdec23
|
@ -340,8 +340,12 @@ void RemoveEvent(int event_type)
|
||||||
|
|
||||||
void RemoveThreadsafeEvent(int event_type)
|
void RemoveThreadsafeEvent(int event_type)
|
||||||
{
|
{
|
||||||
|
externalEventSection.Enter();
|
||||||
if (!tsFirst)
|
if (!tsFirst)
|
||||||
|
{
|
||||||
|
externalEventSection.Leave();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (tsFirst->type == event_type)
|
if (tsFirst->type == event_type)
|
||||||
{
|
{
|
||||||
Event *next = tsFirst->next;
|
Event *next = tsFirst->next;
|
||||||
|
@ -349,7 +353,10 @@ void RemoveThreadsafeEvent(int event_type)
|
||||||
tsFirst = next;
|
tsFirst = next;
|
||||||
}
|
}
|
||||||
if (!tsFirst)
|
if (!tsFirst)
|
||||||
|
{
|
||||||
|
externalEventSection.Leave();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Event *prev = tsFirst;
|
Event *prev = tsFirst;
|
||||||
Event *ptr = prev->next;
|
Event *ptr = prev->next;
|
||||||
while (ptr)
|
while (ptr)
|
||||||
|
@ -366,6 +373,7 @@ void RemoveThreadsafeEvent(int event_type)
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
externalEventSection.Leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveAllEvents(int event_type)
|
void RemoveAllEvents(int event_type)
|
||||||
|
|
Loading…
Reference in New Issue