diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-26 21:46:37 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-26 21:46:37 +0200 |
| commit | 4b28e4626e744ac9b779a680f8e9647014956dda (patch) | |
| tree | 9b5203e083ed27091c70d60e3cdf9284af680c81 /kapi | |
| parent | e7cb0a5dab291d453fa34c5d1250d85e82478ecf (diff) | |
| download | kernel-4b28e4626e744ac9b779a680f8e9647014956dda.tar.xz kernel-4b28e4626e744ac9b779a680f8e9647014956dda.zip | |
kapi/devices: implement locking discipline
Diffstat (limited to 'kapi')
| -rw-r--r-- | kapi/kapi/devices/bus.hpp | 3 | ||||
| -rw-r--r-- | kapi/kapi/devices/device_registry.hpp | 3 | ||||
| -rw-r--r-- | kapi/kapi/devices/facet_registry.hpp | 3 |
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; |
