From 5f879ead9155ba66d7395311881f8330df346fd1 Mon Sep 17 00:00:00 2001 From: Donghee Ye Date: Mon, 3 Dec 2018 20:57:21 +0900 Subject: [PATCH] Use atomic bool exchange instead of lock --- rmw_fastrtps_shared_cpp/src/types/guard_condition.hpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rmw_fastrtps_shared_cpp/src/types/guard_condition.hpp b/rmw_fastrtps_shared_cpp/src/types/guard_condition.hpp index 6f0ab0299..ba88faa23 100644 --- a/rmw_fastrtps_shared_cpp/src/types/guard_condition.hpp +++ b/rmw_fastrtps_shared_cpp/src/types/guard_condition.hpp @@ -72,10 +72,7 @@ class GuardCondition bool getHasTriggered() { - std::lock_guard lock(internalMutex_); - bool ret = hasTriggered_; - hasTriggered_ = false; - return ret; + return hasTriggered_.exchange(false); } private: