From d0b07caa9434967e03a73e9da4417ea555f93ca0 Mon Sep 17 00:00:00 2001 From: Sian January Date: Tue, 20 Nov 2018 11:46:31 +0000 Subject: [PATCH 1/2] fix semaphore bug on Windows --- src/ibmras/common/port/windows/Thread.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ibmras/common/port/windows/Thread.cpp b/src/ibmras/common/port/windows/Thread.cpp index 78378cd..0efc42c 100644 --- a/src/ibmras/common/port/windows/Thread.cpp +++ b/src/ibmras/common/port/windows/Thread.cpp @@ -85,9 +85,19 @@ bool Semaphore::wait(uint32 timeout) { IBMRAS_DEBUG(finest, "Semaphore::wait"); DWORD retVal = WaitForSingleObject(handle, timeout * 1000); - if ( !GetLastError()) { - return (retVal == WAIT_OBJECT_0); - } + switch (retVal) + { + case WAIT_OBJECT_0: + IBMRAS_DEBUG(finest, "Semaphore::wait SUCCESS"); + return true; + + case WAIT_TIMEOUT: + IBMRAS_DEBUG(finest, "Semaphore::wait WAIT_TIMEOUT"); + break; + + case WAIT_FAILED: + IBMRAS_DEBUG(finest, "Semaphore::wait WAIT_FAILED"); + } return false; } From 398c6aa59650a67ae1bb4d072362d31c9ab89965 Mon Sep 17 00:00:00 2001 From: Sian January Date: Tue, 20 Nov 2018 11:48:14 +0000 Subject: [PATCH 2/2] fix tabs --- src/ibmras/common/port/windows/Thread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ibmras/common/port/windows/Thread.cpp b/src/ibmras/common/port/windows/Thread.cpp index 0efc42c..602dc74 100644 --- a/src/ibmras/common/port/windows/Thread.cpp +++ b/src/ibmras/common/port/windows/Thread.cpp @@ -95,7 +95,7 @@ bool Semaphore::wait(uint32 timeout) { IBMRAS_DEBUG(finest, "Semaphore::wait WAIT_TIMEOUT"); break; - case WAIT_FAILED: + case WAIT_FAILED: IBMRAS_DEBUG(finest, "Semaphore::wait WAIT_FAILED"); } return false;