Skip to content

Commit

Permalink
Fix issue with creating temporary std::lock_gard which immediately re…
Browse files Browse the repository at this point in the history
…leases lock
  • Loading branch information
rbroker committed Dec 3, 2023
1 parent 4808c0c commit 5a0ea97
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ecodan-ha-local/ehal_hp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ namespace ehal::hp
cmd.set_float16(newTemp, 10);

{
std::lock_guard<std::mutex>{cmdQueueMutex};
std::lock_guard<std::mutex> lock{cmdQueueMutex};
cmdQueue.emplace(std::move(cmd));
}

Expand Down Expand Up @@ -336,7 +336,7 @@ namespace ehal::hp
cmd.set_float16(newTemp, 10);

{
std::lock_guard<std::mutex>{cmdQueueMutex};
std::lock_guard<std::mutex> lock{cmdQueueMutex};
cmdQueue.emplace(std::move(cmd));
}

Expand Down Expand Up @@ -368,7 +368,7 @@ namespace ehal::hp
cmd.set_float16(newTemp, 8);

{
std::lock_guard<std::mutex>{cmdQueueMutex};
std::lock_guard<std::mutex> lock{cmdQueueMutex};
cmdQueue.emplace(std::move(cmd));
}

Expand Down Expand Up @@ -399,7 +399,7 @@ namespace ehal::hp
cmd[5] = static_cast<uint8_t>(dhwMode);

{
std::lock_guard<std::mutex>{cmdQueueMutex};
std::lock_guard<std::mutex> lock{cmdQueueMutex};
cmdQueue.emplace(std::move(cmd));
}

Expand All @@ -419,7 +419,7 @@ namespace ehal::hp
cmd[3] = on ? 1 : 0; // bit[3] of payload is DHW force, bit[2] is Holiday mode.

{
std::lock_guard<std::mutex>{cmdQueueMutex};
std::lock_guard<std::mutex> lock{cmdQueueMutex};
cmdQueue.emplace(std::move(cmd));
}

Expand Down Expand Up @@ -458,7 +458,7 @@ namespace ehal::hp
cmd[6] = mode;

{
std::lock_guard<std::mutex>{cmdQueueMutex};
std::lock_guard<std::mutex> lock{cmdQueueMutex};
cmdQueue.emplace(std::move(cmd));
}

Expand Down

0 comments on commit 5a0ea97

Please sign in to comment.