Make JKRHeap::sCurrentHeap thread local

Needed because we're using true OS threading, so we can't do the normal JSystem heap changing on thread change.

Requires encapsulating it (removing the public static field)
This commit is contained in:
PJB3005
2026-02-24 23:35:16 +01:00
parent daa7999da1
commit f2dacf2a75
3 changed files with 33 additions and 5 deletions
+10
View File
@@ -169,9 +169,17 @@ public:
static JKRHeap* getRootHeap2() { return sRootHeap2; }
static JKRHeap* getSystemHeap() { return sSystemHeap; }
#if TARGET_PC
static JKRHeap* getCurrentHeap();
#else
static JKRHeap* getCurrentHeap() { return sCurrentHeap; }
#endif
static void setSystemHeap(JKRHeap* heap) { sSystemHeap = heap; }
#if TARGET_PC
static void setCurrentHeap(JKRHeap* heap);
#else
static void setCurrentHeap(JKRHeap* heap) { sCurrentHeap = heap; }
#endif
static void setState_u32ID_(TState* state, u32 id) { state->mId = id; }
static void setState_uUsedSize_(TState* state, u32 usedSize) { state->mUsedSize = usedSize; }
@@ -195,7 +203,9 @@ public:
static JKRHeap* sRootHeap2;
static JKRHeap* sSystemHeap;
#if !TARGET_PC // Hide sCurrentHeap, we need to make it thread local.
static JKRHeap* sCurrentHeap;
#endif
static JKRErrorHandler mErrorHandler;
};