From 1b7821a474da216bd89052902347f97f2a1d796c Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 6 Feb 2024 21:47:28 +1100 Subject: improve the locking strategy of the bluetooth fsm --- src/drivers/include/bluetooth.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/drivers/include/bluetooth.hpp') diff --git a/src/drivers/include/bluetooth.hpp b/src/drivers/include/bluetooth.hpp index c2962e64..2936fb8e 100644 --- a/src/drivers/include/bluetooth.hpp +++ b/src/drivers/include/bluetooth.hpp @@ -105,6 +105,8 @@ class BluetoothState : public tinyfsm::Fsm { public: static auto Init(NvsStorage& storage) -> void; + static auto lock() -> std::lock_guard; + static auto devices() -> std::vector; static auto preferred_device() -> std::optional; @@ -141,7 +143,7 @@ class BluetoothState : public tinyfsm::Fsm { static NvsStorage* sStorage_; static Scanner* sScanner_; - static std::mutex sDevicesMutex_; + static std::mutex sFsmMutex; static std::map sDevices_; static std::optional sPreferredDevice_; -- cgit v1.2.3