Skip to content

Commit

Permalink
Avoid unnecessary copy in async lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
firthm01 committed May 13, 2024
1 parent 942ba7b commit d216065
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ void MonitoringMetadataReceiver::handleReceive(std::error_code ec,
}
// Called by NNG callback on thread with small stack.
// Launch task in another thread to overcome stack limitation.
auto future = std::async(std::launch::async, [this, sceneStore]() {
auto future = std::async(std::launch::async, [this, sceneStore = std::move(sceneStore)]() {
handler_(sceneStore);
});
future.get();
future.get(); //blocking
} catch (const std::runtime_error& e) {
EAR_LOGGER_ERROR(
logger_, "Failed to parse and dispatch scene metadata: {}", e.what());
Expand Down

0 comments on commit d216065

Please sign in to comment.