Used std::atomic for ThreadState
This commit is contained in:
@@ -32,12 +32,12 @@ namespace Bloom
|
||||
}
|
||||
|
||||
Logger::info("Shutting down SignalHandler");
|
||||
Thread::setThreadState(ThreadState::STOPPED);
|
||||
this->threadState = ThreadState::STOPPED;
|
||||
}
|
||||
|
||||
void SignalHandler::startup() {
|
||||
this->setName("SH");
|
||||
Thread::setThreadState(ThreadState::STARTING);
|
||||
this->threadState = ThreadState::STARTING;
|
||||
Logger::debug("Starting SignalHandler");
|
||||
// Block all signal interrupts
|
||||
auto signalSet = this->getRegisteredSignalSet();
|
||||
@@ -54,9 +54,9 @@ namespace Bloom
|
||||
std::bind(&SignalHandler::triggerApplicationShutdown, this)
|
||||
));
|
||||
|
||||
// It's possible that the SignalHandler has been instructed to shutdown, before it could finish starting up.
|
||||
// It's possible that the SignalHandler has been instructed to shut down, before it could finish starting up.
|
||||
if (this->getThreadState() != ThreadState::SHUTDOWN_INITIATED) {
|
||||
Thread::setThreadState(ThreadState::READY);
|
||||
this->threadState = ThreadState::READY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Bloom
|
||||
* Triggers the shutdown of the SignalHandler thread.
|
||||
*/
|
||||
void triggerShutdown() {
|
||||
this->setThreadState(ThreadState::SHUTDOWN_INITIATED);
|
||||
this->threadState = ThreadState::SHUTDOWN_INITIATED;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user