Skip to content

Commit

Permalink
fix semaphore bug on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanuary committed Nov 20, 2018
1 parent d94245a commit d0b07ca
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/ibmras/common/port/windows/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Expand Down

0 comments on commit d0b07ca

Please sign in to comment.