mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-12-23 03:11:49 +01:00
Do not hardcode the threadname in the CThread class
This commit is contained in:
parent
85cedda15e
commit
45ea7ac07e
@ -1,7 +1,7 @@
|
||||
#include "BackgroundThreadWrapper.hpp"
|
||||
#include <coreinit/cache.h>
|
||||
|
||||
BackgroundThreadWrapper::BackgroundThreadWrapper(int32_t priority) : CThread(CThread::eAttributeAffCore2, priority, 0x100000) {
|
||||
BackgroundThreadWrapper::BackgroundThreadWrapper(int32_t priority) : CThread(CThread::eAttributeAffCore2, priority, 0x100000, nullptr, nullptr, "FTPiiU Server") {
|
||||
}
|
||||
|
||||
BackgroundThreadWrapper::~BackgroundThreadWrapper() {
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <coreinit/systeminfo.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <malloc.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
class CThread {
|
||||
@ -28,7 +29,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;
|
||||
@ -39,7 +40,8 @@ public:
|
||||
//! create the thread
|
||||
if (pThread && pThreadStack) {
|
||||
OSCreateThread(pThread, &CThread::threadCallback, 1, (char *) this, pThreadStack + iStackSize, iStackSize, iPriority, iAttributes);
|
||||
OSSetThreadName(pThread, "FTP Server Thread");
|
||||
pThreadName = threadName;
|
||||
OSSetThreadName(pThread, pThreadName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,6 +140,7 @@ private:
|
||||
uint8_t *pThreadStack;
|
||||
Callback pCallback;
|
||||
void *pCallbackArg;
|
||||
std::string pThreadName;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user