Skip to content

Commit 609db04

Browse files
committed
Change to recursive_mutex for keeping the previous behavement
1 parent 87272a2 commit 609db04

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/hx/gc/Immix.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ static int sgTimeToNextTableUpdate = 1;
394394

395395

396396

397-
std::mutex *gThreadStateChangeLock=nullptr;
397+
std::recursive_mutex *gThreadStateChangeLock=nullptr;
398398
std::mutex *gSpecialObjectLock=nullptr;
399399

400400
class LocalAllocator;
@@ -3133,12 +3133,12 @@ class GlobalAllocator
31333133
{
31343134
if (!gThreadStateChangeLock)
31353135
{
3136-
gThreadStateChangeLock = new std::mutex();
3136+
gThreadStateChangeLock = new std::recursive_mutex();
31373137
gSpecialObjectLock = new std::mutex();
31383138
}
31393139
// Until we add ourselves, the collector will not wait
31403140
// on us - ie, we are assumed ot be in a GC free zone.
3141-
std::lock_guard<std::mutex> lock(*gThreadStateChangeLock);
3141+
std::lock_guard<std::recursive_mutex> lock(*gThreadStateChangeLock);
31423142
mLocalAllocs.push(inAlloc);
31433143
// TODO Attach debugger
31443144
}
@@ -3161,7 +3161,7 @@ class GlobalAllocator
31613161

31623162
LocalAllocator *GetPooledAllocator()
31633163
{
3164-
std::lock_guard<std::mutex> lock(*gThreadStateChangeLock);
3164+
std::lock_guard<std::recursive_mutex> lock(*gThreadStateChangeLock);
31653165
for(int p=0;p<LOCAL_POOL_SIZE;p++)
31663166
{
31673167
if (mLocalPool[p])
@@ -5857,7 +5857,7 @@ class LocalAllocator : public hx::StackContext
58575857
EnterGCFreeZone();
58585858
#endif
58595859

5860-
std::lock_guard<std::mutex> lock(*gThreadStateChangeLock);
5860+
std::lock_guard<std::recursive_mutex> lock(*gThreadStateChangeLock);
58615861

58625862
#ifdef HX_WINDOWS
58635863
mID = 0;
@@ -6084,7 +6084,7 @@ class LocalAllocator : public hx::StackContext
60846084
if (!mGCFreeZone)
60856085
CriticalGCError("GCFree Zone mismatch");
60866086

6087-
std::lock_guard<std::mutex> lock(*gThreadStateChangeLock);
6087+
std::lock_guard<std::recursive_mutex> lock(*gThreadStateChangeLock);
60886088
mReadyForCollect.Reset();
60896089
mGCFreeZone = false;
60906090
#endif

0 commit comments

Comments
 (0)