Skip to content

Commit

Permalink
Merge pull request #72 from sjanuary/winfix
Browse files Browse the repository at this point in the history
Fix Semaphore bug on Windows (no CPU/mem/env data on Node 10)
  • Loading branch information
tobespc authored Nov 21, 2018
2 parents d94245a + 398c6aa commit 918dbd3
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 918dbd3

Please sign in to comment.