lock syntax error

This commit is contained in:
Philippe G
2021-12-24 01:09:34 -08:00
parent 662962ddb1
commit 523127bdea

View File

@@ -149,7 +149,7 @@ RECONNECT:
void MercuryManager::runTask() void MercuryManager::runTask()
{ {
std::scoped_lock(this->runningMutex); std::scoped_lock lock(this->runningMutex);
// Listen for mercury replies and handle them accordingly // Listen for mercury replies and handle them accordingly
isRunning = true; isRunning = true;
while (isRunning) while (isRunning)
@@ -161,9 +161,10 @@ void MercuryManager::runTask()
} }
catch (const std::runtime_error& e) catch (const std::runtime_error& e)
{ {
if (!isRunning) break;
// Reconnection required // Reconnection required
if (isRunning) this->reconnect(); this->reconnect();
if (isRunning) this->reconnectedCallback(); this->reconnectedCallback();
continue; continue;
} }
if (static_cast<MercuryType>(packet->command) == MercuryType::PING) // @TODO: Handle time synchronization through ping if (static_cast<MercuryType>(packet->command) == MercuryType::PING) // @TODO: Handle time synchronization through ping
@@ -191,7 +192,7 @@ void MercuryManager::stop() {
CSPOT_LOG(debug, "Stopping mercury manager"); CSPOT_LOG(debug, "Stopping mercury manager");
isRunning = false; isRunning = false;
audioChunkManager->close(); audioChunkManager->close();
std::scoped_lock(audioChunkManager->runningMutex, this->runningMutex); std::scoped_lock lock(audioChunkManager->runningMutex, this->runningMutex);
CSPOT_LOG(debug, "mercury stopped"); CSPOT_LOG(debug, "mercury stopped");
} }