[c-host] app: fix updateEvent race problem

This commit is contained in:
Geoffrey McRae
2019-03-04 13:38:17 +11:00
parent 6e35033f2e
commit a8b018d5da
4 changed files with 24 additions and 17 deletions

View File

@@ -76,7 +76,7 @@ static bool dxgi_create()
return false;
}
this->copyEvent = os_createEvent();
this->copyEvent = os_createEvent(true);
if (!this->copyEvent)
{
DEBUG_ERROR("failed to create the copy event");

View File

@@ -300,9 +300,15 @@ bool os_joinThread(osThreadHandle * handle, int * resultCode)
return false;
}
osEventHandle * os_createEvent()
osEventHandle * os_createEvent(bool autoReset)
{
HANDLE event = CreateEvent(NULL, FALSE, FALSE, NULL);
HANDLE event = CreateEvent(NULL, autoReset ? FALSE : TRUE, FALSE, NULL);
if (!event)
{
DEBUG_WINERROR("Failed to create the event", GetLastError());
return NULL;
}
return (osEventHandle*)event;
}
@@ -337,4 +343,9 @@ bool os_waitEvent(osEventHandle * handle)
bool os_signalEvent(osEventHandle * handle)
{
return SetEvent((HANDLE)handle);
}
bool os_resetEvent(osEventHandle * handle)
{
return ResetEvent((HANDLE)handle);
}