aboutsummaryrefslogtreecommitdiff
path: root/src/jthread/win32
diff options
context:
space:
mode:
Diffstat (limited to 'src/jthread/win32')
-rw-r--r--src/jthread/win32/jmutex.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/jthread/win32/jmutex.cpp b/src/jthread/win32/jmutex.cpp
index d079d448d..8a31495cd 100644
--- a/src/jthread/win32/jmutex.cpp
+++ b/src/jthread/win32/jmutex.cpp
@@ -29,7 +29,14 @@
JMutex::JMutex()
{
- initialized = false;
+#ifdef JMUTEX_CRITICALSECTION
+ InitializeCriticalSection(&mutex);
+#else
+ mutex = CreateMutex(NULL,FALSE,NULL);
+ if (mutex == NULL)
+ return ERR_JMUTEX_CANTCREATEMUTEX;
+#endif // JMUTEX_CRITICALSECTION
+ initialized = true;
}
JMutex::~JMutex()
@@ -44,16 +51,6 @@ JMutex::~JMutex()
int JMutex::Init()
{
- if (initialized)
- return ERR_JMUTEX_ALREADYINIT;
-#ifdef JMUTEX_CRITICALSECTION
- InitializeCriticalSection(&mutex);
-#else
- mutex = CreateMutex(NULL,FALSE,NULL);
- if (mutex == NULL)
- return ERR_JMUTEX_CANTCREATEMUTEX;
-#endif // JMUTEX_CRITICALSECTION
- initialized = true;
return 0;
}