fixed race condition during shutdown
This commit is contained in:
+2
-2
@@ -669,11 +669,11 @@ void signalHandler(int sig) {
|
||||
break;
|
||||
case SIGINT:
|
||||
logNotice(lf_main, "SIGINT received");
|
||||
shutdown();
|
||||
s_mainLoop->join();
|
||||
break;
|
||||
case SIGTERM:
|
||||
logNotice(lf_main, "SIGTERM received");
|
||||
shutdown();
|
||||
s_mainLoop->join();
|
||||
break;
|
||||
default:
|
||||
logNotice(lf_main, "undefined signal %s", strsignal(sig));
|
||||
|
||||
@@ -100,7 +100,7 @@ result_t UserList::addFromFile(map<string, string>& row, vector< map<string, str
|
||||
MainLoop::MainLoop(const struct options opt, Device *device, MessageMap* messages)
|
||||
: Thread(), m_device(device), m_reconnectCount(0), m_userList(opt.accessLevel), m_messages(messages),
|
||||
m_address(opt.address), m_scanConfig(opt.scanConfig),
|
||||
m_initialScan(opt.initialScan), m_enableHex(opt.enableHex) {
|
||||
m_initialScan(opt.initialScan), m_enableHex(opt.enableHex), m_shutdown(false) {
|
||||
// open Device
|
||||
result_t result = m_device->open();
|
||||
if (result != RESULT_OK) {
|
||||
|
||||
@@ -112,6 +112,11 @@ class MainLoop : public Thread, DeviceListener {
|
||||
*/
|
||||
~MainLoop();
|
||||
|
||||
/**
|
||||
* Shutdown the main loop.
|
||||
*/
|
||||
void shutdown() { m_shutdown = true; }
|
||||
|
||||
/**
|
||||
* Get the @a BusHandler instance.
|
||||
* @return the created @a BusHandler instance.
|
||||
|
||||
Reference in New Issue
Block a user