mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-09-03 03:32:37 +02:00
Fixes for vmu profiler / thread
This commit is contained in:
@@ -14,11 +14,17 @@ Thread::Thread(const char* label, size_t stackSize, bool detached, RunFunction r
|
|||||||
}
|
}
|
||||||
|
|
||||||
Thread::~Thread() {
|
Thread::~Thread() {
|
||||||
if(!detached_) join();
|
if(!detached_) {
|
||||||
|
join();
|
||||||
|
} else {
|
||||||
|
#if !defined(DC_SH4)
|
||||||
|
delete reinterpret_cast<std::thread*>(nativeHandle_);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Thread::spawn(const char *label, size_t stackSize, bool detached, RunFunction runFunction, void* param) {
|
bool Thread::spawn(const char *label, size_t stackSize, bool detached, RunFunction runFunction, void* param) {
|
||||||
#ifdef DC_SH4
|
#if defined(DC_SH4)
|
||||||
const kthread_attr_t thdAttr = {
|
const kthread_attr_t thdAttr = {
|
||||||
.create_detached = detached,
|
.create_detached = detached,
|
||||||
.stack_size = stackSize,
|
.stack_size = stackSize,
|
||||||
@@ -40,10 +46,11 @@ bool Thread::join() {
|
|||||||
if(!isValid() || detached_)
|
if(!isValid() || detached_)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef DC_SH4
|
#if defined(DC_SH4)
|
||||||
if(thd_join(reinterpret_cast<kthread_t*>(nativeHandle_), nullptr) != 0)
|
if(thd_join(reinterpret_cast<kthread_t*>(nativeHandle_), nullptr) != 0)
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
|
reinterpret_cast<std::thread*>(nativeHandle_)->join();
|
||||||
delete reinterpret_cast<std::thread*>(nativeHandle_);
|
delete reinterpret_cast<std::thread*>(nativeHandle_);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -62,7 +62,7 @@ protected:
|
|||||||
VmuProfiler();
|
VmuProfiler();
|
||||||
|
|
||||||
// Main entry point and loop for the monitor thread
|
// Main entry point and loop for the monitor thread
|
||||||
virtual void run();
|
void run();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user