diff options
Diffstat (limited to 'src/jthread/win32')
-rwxr-xr-x | src/jthread/win32/jsemaphore.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/jthread/win32/jsemaphore.cpp b/src/jthread/win32/jsemaphore.cpp index 3a1f2715c..34167f391 100755 --- a/src/jthread/win32/jsemaphore.cpp +++ b/src/jthread/win32/jsemaphore.cpp @@ -51,6 +51,21 @@ void JSemaphore::Wait() { INFINITE); } +bool JSemaphore::Wait(unsigned int time_ms) { + unsigned int retval = WaitForSingleObject( + m_hSemaphore, + time_ms); + + if (retval == WAIT_OBJECT_0) + { + return true; + } + else { + assert(retval == WAIT_TIMEOUT); + return false; + } +} + int JSemaphore::GetValue() { long int retval = 0; |