1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix log threadname lookup handling not beeing threadsafe

This commit is contained in:
sapier 2013-11-30 21:22:15 +01:00
parent e605d70256
commit de0cdbc01c
3 changed files with 19 additions and 21 deletions

View file

@ -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;
}