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