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

activex: use events iso semaphore

parent ecfea08f
...@@ -107,14 +107,7 @@ public: ...@@ -107,14 +107,7 @@ public:
static void ConditionInit(HANDLE *handle) static void ConditionInit(HANDLE *handle)
{ {
/* *handle = CreateEvent(NULL, TRUE, FALSE, NULL); *handle = CreateEvent(NULL, TRUE, FALSE, NULL);
*/
*handle = CreateSemaphore(
NULL, // default security attributes
0, // initial count
1, // maximum count
NULL); // unnamed semaphore
if (*handle == NULL) if (*handle == NULL)
abort(); abort();
} }
...@@ -130,20 +123,18 @@ static void ConditionWait(HANDLE *handle, CRITICAL_SECTION *lock) ...@@ -130,20 +123,18 @@ static void ConditionWait(HANDLE *handle, CRITICAL_SECTION *lock)
do { do {
LeaveCriticalSection(lock); LeaveCriticalSection(lock);
dwWaitResult = WaitForSingleObject(*handle, INFINITE); dwWaitResult = WaitForSingleObjectEx(*handle, INFINITE, TRUE);
//dwWaitResult = WaitForSingleObjectEx(*handle, INFINITE, TRUE);
EnterCriticalSection(lock); EnterCriticalSection(lock);
} while(dwWaitResult == WAIT_IO_COMPLETION); } while(dwWaitResult == WAIT_IO_COMPLETION);
assert(dwWaitResult != WAIT_ABANDONED); /* another thread failed to cleanup! */ assert(dwWaitResult != WAIT_ABANDONED); /* another thread failed to cleanup! */
assert(dwWaitResult != WAIT_FAILED); assert(dwWaitResult != WAIT_FAILED);
//ResetEvent(*handle); ResetEvent(*handle);
} }
static void ConditionSignal(HANDLE *handle) static void ConditionSignal(HANDLE *handle)
{ {
//SetEvent(*handle); SetEvent(*handle);
ReleaseSemaphore(*handle, 1L, NULL);
} }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
......
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