aboutsummaryrefslogtreecommitdiff
path: root/kernel/kapi/devices/bus.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-07-26 22:13:52 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-07-26 22:13:52 +0200
commit705c98d47937d603e3ad569cc2ade12fa1df3677 (patch)
tree6cd980e01943a87126ec51a248ffc4f03a195e5f /kernel/kapi/devices/bus.cpp
parent4b28e4626e744ac9b779a680f8e9647014956dda (diff)
downloadkernel-705c98d47937d603e3ad569cc2ade12fa1df3677.tar.xz
kernel-705c98d47937d603e3ad569cc2ade12fa1df3677.zip
build: add tsan build
Diffstat (limited to 'kernel/kapi/devices/bus.cpp')
-rw-r--r--kernel/kapi/devices/bus.cpp12
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 *