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:
parent
e605d70256
commit
de0cdbc01c
3 changed files with 19 additions and 21 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue