Remove the hardcoded threadname from the CThread class

This commit is contained in:
Maschell 2022-10-05 18:44:52 +02:00
parent 03b9a7a928
commit c8df037005
3 changed files with 5 additions and 4 deletions

View File

@ -40,7 +40,6 @@ ON_APPLICATION_START() {
} }
ON_APPLICATION_REQUESTS_EXIT() { ON_APPLICATION_REQUESTS_EXIT() {
DEBUG_FUNCTION_LINE("Stop wiiload thread"); DEBUG_FUNCTION_LINE("Stop wiiload thread");
stopThread(); stopThread();

View File

@ -27,7 +27,7 @@ public:
typedef void (*Callback)(CThread *thread, void *arg); typedef void (*Callback)(CThread *thread, void *arg);
//! constructor //! constructor
explicit CThread(int32_t iAttr, int32_t iPriority = 16, int32_t iStackSize = 0x8000, CThread::Callback callback = nullptr, void *callbackArg = nullptr) explicit CThread(int32_t iAttr, int32_t iPriority = 16, int32_t iStackSize = 0x8000, CThread::Callback callback = nullptr, void *callbackArg = nullptr, const std::string &threadName = "")
: pThread(nullptr), pThreadStack(nullptr), pCallback(callback), pCallbackArg(callbackArg) { : pThread(nullptr), pThreadStack(nullptr), pCallback(callback), pCallbackArg(callbackArg) {
//! save attribute assignment //! save attribute assignment
iAttributes = iAttr; iAttributes = iAttr;
@ -38,7 +38,8 @@ public:
//! create the thread //! create the thread
if (pThread && pThreadStack) { if (pThread && pThreadStack) {
OSCreateThread(pThread, &CThread::threadCallback, 1, (char *) this, pThreadStack + iStackSize, iStackSize, iPriority, iAttributes); OSCreateThread(pThread, &CThread::threadCallback, 1, (char *) this, pThreadStack + iStackSize, iStackSize, iPriority, iAttributes);
OSSetThreadName(pThread, "Wiiload Thread"); pThreadName = threadName;
OSSetThreadName(pThread, pThreadName.c_str());
} }
} }
@ -141,4 +142,5 @@ private:
uint8_t *pThreadStack; uint8_t *pThreadStack;
Callback pCallback; Callback pCallback;
void *pCallbackArg; void *pCallbackArg;
std::string pThreadName;
}; };

View File

@ -24,7 +24,7 @@
#define WUHB_TEMP_FILE_2_EX "wiiu/apps/temp2.wuhb" #define WUHB_TEMP_FILE_2_EX "wiiu/apps/temp2.wuhb"
TcpReceiver::TcpReceiver(int32_t port) TcpReceiver::TcpReceiver(int32_t port)
: CThread(CThread::eAttributeAffCore1, 16, 0x20000), exitRequested(false), serverPort(port), serverSocket(-1) { : CThread(CThread::eAttributeAffCore1, 16, 0x20000, nullptr, nullptr, "Wiiload Thread"), exitRequested(false), serverPort(port), serverSocket(-1) {
resumeThread(); resumeThread();
} }