From c8df037005e4c67906fc4b577b9f56f684cd326b Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 5 Oct 2022 18:44:52 +0200 Subject: [PATCH] Remove the hardcoded threadname from the CThread class --- src/main.cpp | 1 - src/utils/CThread.h | 6 ++++-- src/utils/TcpReceiver.cpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3f533a1..0142428 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,7 +40,6 @@ ON_APPLICATION_START() { } - ON_APPLICATION_REQUESTS_EXIT() { DEBUG_FUNCTION_LINE("Stop wiiload thread"); stopThread(); diff --git a/src/utils/CThread.h b/src/utils/CThread.h index d93e910..af3b100 100644 --- a/src/utils/CThread.h +++ b/src/utils/CThread.h @@ -27,7 +27,7 @@ public: typedef void (*Callback)(CThread *thread, void *arg); //! 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) { //! save attribute assignment iAttributes = iAttr; @@ -38,7 +38,8 @@ public: //! create the thread if (pThread && pThreadStack) { 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; Callback pCallback; void *pCallbackArg; + std::string pThreadName; }; \ No newline at end of file diff --git a/src/utils/TcpReceiver.cpp b/src/utils/TcpReceiver.cpp index 9a7b19a..e843cbe 100644 --- a/src/utils/TcpReceiver.cpp +++ b/src/utils/TcpReceiver.cpp @@ -24,7 +24,7 @@ #define WUHB_TEMP_FILE_2_EX "wiiu/apps/temp2.wuhb" 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(); }