aboutsummaryrefslogtreecommitdiff
path: root/src/jthread/win32
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-01-06 12:45:42 +0100
committersapier <Sapier at GMX dot net>2014-01-10 10:10:45 +0100
commit8b0b857eaaa50c6ec217a46c0577395c78ec04c7 (patch)
treeb9fd5e1edb099aee1498b29a43702568a283aa34 /src/jthread/win32
parent10fdbf737513e48bfcfb9e90fe243dcd989c0476 (diff)
downloadminetest-8b0b857eaaa50c6ec217a46c0577395c78ec04c7.tar.gz
minetest-8b0b857eaaa50c6ec217a46c0577395c78ec04c7.tar.bz2
minetest-8b0b857eaaa50c6ec217a46c0577395c78ec04c7.zip
Make MutexQueue use jsemaphore for signaling
Diffstat (limited to 'src/jthread/win32')
-rwxr-xr-xsrc/jthread/win32/jsemaphore.cpp15
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;