From 71f46c2e9d62ac9810b96c40bc0bd2d50fac4e9c Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Thu, 2 Mar 2023 15:12:02 +0100 Subject: [PATCH 1/2] Fix race condition in System::ClockBuilder --- src/System/include/BipedalLocomotion/System/Clock.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/System/include/BipedalLocomotion/System/Clock.h b/src/System/include/BipedalLocomotion/System/Clock.h index 73b5976210..c374ca9816 100644 --- a/src/System/include/BipedalLocomotion/System/Clock.h +++ b/src/System/include/BipedalLocomotion/System/Clock.h @@ -8,6 +8,7 @@ #ifndef BIPEDAL_LOCOMOTION_SYSTEM_CLOCK_H #define BIPEDAL_LOCOMOTION_SYSTEM_CLOCK_H +#include #include #include @@ -30,9 +31,9 @@ class ClockBuilder * Pointer to factory used to build the clock */ inline static std::shared_ptr m_factory{std::make_shared()}; - inline static bool m_clockAlreadyCalledOnce{false}; /**< True if the clock() has been already - called once. If True it will not be - possible to set a new Factory */ + inline static std::atomic m_clockAlreadyCalledOnce{false}; /**< True if the clock() has been already + called once. If True it will not be + possible to set a new Factory */ public: /** From 7b1d1e7d04273446cbdae7a7c35321bf76236f59 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Thu, 2 Mar 2023 15:15:48 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3c121c18c..ab8d36c848 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ All notable changes to this project are documented in this file. - Return an invalid `PolyDriverDescriptor` if `description` is not found in `constructMultipleAnalogSensorsRemapper()` (https://github.com/ami-iit/bipedal-locomotion-framework/pull/569) - Fix compatibility with OpenCV 4.7.0 (https://github.com/ami-iit/bipedal-locomotion-framework/pull/589) - Fix `attachRemappedRemoteControlBoard` in `YarpSensorBridge` when the `RemoteControlBoard` is not the first polydriver in the polydriverlist (https://github.com/ami-iit/bipedal-locomotion-framework/pull/608) +- Fix race condition in System::ClockBuilder (https://github.com/ami-iit/bipedal-locomotion-framework/pull/618) ## [0.11.1] - 2022-12-19 ### Fix