Commit 744486e5 authored by Jean-Paul Saman's avatar Jean-Paul Saman

activex: use events iso semaphore

parent ecfea08f
......@@ -107,14 +107,7 @@ public:
static void ConditionInit(HANDLE *handle)
{
/* *handle = CreateEvent(NULL, TRUE, FALSE, NULL);
*/
*handle = CreateSemaphore(
NULL, // default security attributes
0, // initial count
1, // maximum count
NULL); // unnamed semaphore
*handle = CreateEvent(NULL, TRUE, FALSE, NULL);
if (*handle == NULL)
abort();
}
......@@ -130,20 +123,18 @@ static void ConditionWait(HANDLE *handle, CRITICAL_SECTION *lock)
do {
LeaveCriticalSection(lock);
dwWaitResult = WaitForSingleObject(*handle, INFINITE);
//dwWaitResult = WaitForSingleObjectEx(*handle, INFINITE, TRUE);
dwWaitResult = WaitForSingleObjectEx(*handle, INFINITE, TRUE);
EnterCriticalSection(lock);
} while(dwWaitResult == WAIT_IO_COMPLETION);
assert(dwWaitResult != WAIT_ABANDONED); /* another thread failed to cleanup! */
assert(dwWaitResult != WAIT_FAILED);
//ResetEvent(*handle);
ResetEvent(*handle);
}
static void ConditionSignal(HANDLE *handle)
{
//SetEvent(*handle);
ReleaseSemaphore(*handle, 1L, NULL);
SetEvent(*handle);
}
////////////////////////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment