Skip to content

Commit

Permalink
Merge pull request #618 from ami-iit/fix/617
Browse files Browse the repository at this point in the history
Fix race condition in System::ClockBuilder
  • Loading branch information
GiulioRomualdi authored Mar 2, 2023
2 parents 0321b4c + 7b1d1e7 commit 70afa42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/System/include/BipedalLocomotion/System/Clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifndef BIPEDAL_LOCOMOTION_SYSTEM_CLOCK_H
#define BIPEDAL_LOCOMOTION_SYSTEM_CLOCK_H

#include <atomic>
#include <memory>

#include <BipedalLocomotion/System/IClock.h>
Expand All @@ -30,9 +31,9 @@ class ClockBuilder
* Pointer to factory used to build the clock
*/
inline static std::shared_ptr<ClockFactory> m_factory{std::make_shared<StdClockFactory>()};
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<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 */

public:
/**
Expand Down

0 comments on commit 70afa42

Please sign in to comment.