mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-11-16 17:59:19 +01:00
Only shutdown the thread if it's actually running
This commit is contained in:
parent
09412116ad
commit
1375dbd4c2
@ -14,10 +14,14 @@ BackgroundThread::BackgroundThread() : BackgroundThreadWrapper(BackgroundThread:
|
||||
}
|
||||
|
||||
BackgroundThread::~BackgroundThread() {
|
||||
DEBUG_FUNCTION_LINE("Shutting down FTP Server");
|
||||
stopThread();
|
||||
while (!hasThreadStopped()) {
|
||||
OSSleepTicks(OSMillisecondsToTicks(10));
|
||||
if (!isThreadTerminated()) {
|
||||
DEBUG_FUNCTION_LINE("Shutting down FTP Server");
|
||||
stopThread();
|
||||
while (!hasThreadStopped()) {
|
||||
OSSleepTicks(OSMillisecondsToTicks(10));
|
||||
}
|
||||
} else {
|
||||
DEBUG_FUNCTION_LINE_WARN("Thread is already terminated");
|
||||
}
|
||||
if (this->serverSocket >= 0) {
|
||||
cleanup_ftp();
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
}
|
||||
|
||||
//! Check if thread is terminated
|
||||
[[nodiscard]] virtual BOOL isThreadTerminated() const {
|
||||
[[nodiscard]] BOOL isThreadTerminated() const {
|
||||
if (pThread) return OSIsThreadTerminated(pThread);
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user