Skip to content

Commit

Permalink
Use atomic bool exchange instead of lock
Browse files Browse the repository at this point in the history
  • Loading branch information
DongheeYe committed Dec 7, 2018
1 parent c1345ac commit ad125da
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions rmw_fastrtps_shared_cpp/src/types/guard_condition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ class GuardCondition
bool
getHasTriggered()
{
std::lock_guard<std::mutex> lock(internalMutex_);
bool ret = hasTriggered_;
hasTriggered_ = false;
return ret;
return hasTriggered_.exchange(false);
}

private:
Expand Down

0 comments on commit ad125da

Please sign in to comment.