aboutsummaryrefslogtreecommitdiff
path: root/kapi
diff options
context:
space:
mode:
Diffstat (limited to 'kapi')
-rw-r--r--kapi/kapi/devices/bus.hpp3
-rw-r--r--kapi/kapi/devices/device_registry.hpp3
-rw-r--r--kapi/kapi/devices/facet_registry.hpp3
3 files changed, 9 insertions, 0 deletions
diff --git a/kapi/kapi/devices/bus.hpp b/kapi/kapi/devices/bus.hpp
index 13951e46..2ee12628 100644
--- a/kapi/kapi/devices/bus.hpp
+++ b/kapi/kapi/devices/bus.hpp
@@ -6,6 +6,7 @@
#include <kapi/capabilities/facet_id.hpp>
#include <kapi/devices/bus_protocol.hpp>
#include <kapi/devices/device.hpp>
+#include <kapi/tracked_mutex.hpp>
#include <kstd/memory.hpp>
#include <kstd/print.hpp>
@@ -65,6 +66,8 @@ namespace kapi::devices
private:
auto do_remove_child(device & child) -> void;
+ mutable tracked_mutex m_lock{};
+
bus_protocol * m_protocol{};
kstd::vector<kstd::shared_ptr<device>> m_devices{};
};
diff --git a/kapi/kapi/devices/device_registry.hpp b/kapi/kapi/devices/device_registry.hpp
index a65bd4ad..816ad984 100644
--- a/kapi/kapi/devices/device_registry.hpp
+++ b/kapi/kapi/devices/device_registry.hpp
@@ -4,6 +4,7 @@
// IWYU pragma: private, include <kapi/devices.hpp>
#include <kapi/devices/device.hpp>
+#include <kapi/tracked_mutex.hpp>
#include <kstd/flat_map.hpp>
#include <kstd/memory.hpp>
@@ -79,6 +80,8 @@ namespace kapi::devices
auto subscribe(kstd::weak_ptr<device_registry_observer> observer) -> void;
private:
+ mutable tracked_mutex m_lock{};
+
kstd::flat_map<kstd::string, kstd::weak_ptr<device>> m_devices{};
kstd::vector<kstd::weak_ptr<device_registry_observer>> m_observers{};
};
diff --git a/kapi/kapi/devices/facet_registry.hpp b/kapi/kapi/devices/facet_registry.hpp
index 82bb304b..7006c026 100644
--- a/kapi/kapi/devices/facet_registry.hpp
+++ b/kapi/kapi/devices/facet_registry.hpp
@@ -5,6 +5,7 @@
#include <kapi/capabilities/facet_id.hpp>
#include <kapi/devices/device.hpp>
+#include <kapi/tracked_mutex.hpp>
#include <kstd/memory.hpp>
#include <kstd/result.hpp>
@@ -268,6 +269,8 @@ namespace kapi::devices
//! @param device The device.
auto do_notify_withdrawn(kapi::capabilities::facet_id id, device const & device) -> void;
+ mutable tracked_mutex m_lock{};
+
kstd::vector<entry> m_entries;
kstd::vector<kstd::weak_ptr<facet_registry_observer>> m_observers;
kstd::vector<facet_registry_observer *> m_static_observers;