Device: Make IO system thread-safe

This commit is contained in:
Paul Hollinsky
2021-04-21 10:04:25 -04:00
parent 3b6b4f0541
commit 92589c2ce7
8 changed files with 10 additions and 0 deletions
@@ -95,6 +95,7 @@ protected:
void handleDeviceStatus(const std::shared_ptr<Message>& message) override {
if(!message || message->data.size() < sizeof(neovifire2_status_t))
return;
std::lock_guard<std::mutex> lk(ioMutex);
const neovifire2_status_t* status = reinterpret_cast<const neovifire2_status_t*>(message->data.data());
backupPowerEnabled = status->backupPowerEnabled;
backupPowerGood = status->backupPowerGood;