Skip to content

Commit

Permalink
fix(hw): data race condition on started variable
Browse files Browse the repository at this point in the history
  • Loading branch information
GwnDaan committed Feb 4, 2025
1 parent a71c186 commit cf93199
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ namespace isobus
static std::vector<std::unique_ptr<CANHardware>> hardwareChannels; ///< A list of all CAN channel's metadata
static Mutex hardwareChannelsMutex; ///< Mutex to protect `hardwareChannels`
static Mutex updateMutex; ///< A mutex for the main thread
static bool started; ///< Stores if the threads have been started
static std::atomic_bool started; ///< Stores if the threads have been started
};
}
#endif // CAN_HARDWARE_INTERFACE_HPP
2 changes: 1 addition & 1 deletion hardware_integration/src/can_hardware_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace isobus
std::vector<std::unique_ptr<CANHardwareInterface::CANHardware>> CANHardwareInterface::hardwareChannels;
Mutex CANHardwareInterface::hardwareChannelsMutex;
Mutex CANHardwareInterface::updateMutex;
bool CANHardwareInterface::started = false;
std::atomic_bool CANHardwareInterface::started = { false };

CANHardwareInterface CANHardwareInterface::SINGLETON;

Expand Down

0 comments on commit cf93199

Please sign in to comment.