diff options
Diffstat (limited to 'kernel/kapi/devices/bus.cpp')
| -rw-r--r-- | kernel/kapi/devices/bus.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/kapi/devices/bus.cpp b/kernel/kapi/devices/bus.cpp index 71dd01e6..2b94e486 100644 --- a/kernel/kapi/devices/bus.cpp +++ b/kernel/kapi/devices/bus.cpp @@ -11,7 +11,6 @@ #include <kstd/vector.hpp> #include <algorithm> -#include <span> #include <utility> namespace kapi::devices @@ -36,7 +35,10 @@ namespace kapi::devices auto bus::add_child(kstd::shared_ptr<device> child) -> void { - child->set_parent(kstd::static_pointer_cast<bus>(shared_from_this())); + { + auto guard = kstd::lock_guard{m_lock}; + child->set_parent(kstd::static_pointer_cast<bus>(shared_from_this())); + } if (!kapi::devices::device_registry::get().add(child)) { @@ -74,9 +76,11 @@ namespace kapi::devices return true; } - [[nodiscard]] auto bus::children() const -> std::span<kstd::shared_ptr<device> const> + [[nodiscard]] auto bus::children() const -> kstd::vector<kstd::shared_ptr<device>> { - return {m_devices.data(), m_devices.size()}; + auto guard = kstd::lock_guard{m_lock}; + + return m_devices; } auto bus::query_facet(kapi::capabilities::facet_id facet) -> void * |
