From 0aeec983a4d18b12367a7c68c05e89abb05cff35 Mon Sep 17 00:00:00 2001 From: Sean Miller Date: Thu, 16 Apr 2026 13:15:04 +0100 Subject: Rename ThreadMonitor to ThreadMgr --- src/egg/core/eggThreadMonitor.cpp | 73 --------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 src/egg/core/eggThreadMonitor.cpp (limited to 'src/egg/core/eggThreadMonitor.cpp') diff --git a/src/egg/core/eggThreadMonitor.cpp b/src/egg/core/eggThreadMonitor.cpp deleted file mode 100644 index c7b2a5c6..00000000 --- a/src/egg/core/eggThreadMonitor.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "egg/core/eggThreadMonitor.h" - -#include "rvl/OS.h" - -namespace EGG { - -ThreadMonitor *ThreadMonitor::sInstance; // Never initialized - -s32 ThreadMonitor::getThreadIndex(OSThread *thread) { - for (s32 i = 0; i < mThreadCount; i++) { - if (mThreadList[i].mThread == thread) { - return i; - } - } - return -1; -} - -s32 ThreadMonitor::doRegisterThread(OSThread *thread) { - if (mThreadCount != mMaxThreads) { - s32 i = mThreadCount; - - mThreadList[i].mThread = thread; - mThreadList[i]._04 = _EC; - mThreadList[i]._08 = true; - mThreadList[i]._09[0] = '\0'; - mThreadList[i]._2C = _F4; - - mThreadCount++; - - if (mSortEnabled) { - sortByPriority(); - } - - return getThreadIndex(thread); - } - - return -1; -} - -void ThreadMonitor::sortByPriority() { - // Selection sort on thread priority - for (s32 i = 0; i < mThreadCount - 1; i++) { - OSPriority minPrio = 31; - s32 minPrioIndex = -1; - - for (s32 j = i; j < mThreadCount; j++) { - OSPriority prio = OSGetThreadPriority(mThreadList[j].mThread); - if (prio <= minPrio) { - minPrio = prio; - minPrioIndex = j; - } - } - - if (i != minPrioIndex) { - ThreadInfo temp = mThreadList[i]; - mThreadList[i] = mThreadList[minPrioIndex]; - mThreadList[minPrioIndex] = temp; - } - } -} - -void ThreadMonitor::registerThread(OSThread *thread, UnknownStruct arg) { - s32 i = getThreadIndex(thread); - if (i == -1) { - i = doRegisterThread(thread); - } - - if (i != -1) { - mThreadList[i]._04 = arg; - } -} - -} // namespace EGG -- cgit v1.2.3