diff --git a/local/recipes/drivers/redox-driver-core/source/src/manager.rs b/local/recipes/drivers/redox-driver-core/source/src/manager.rs index 90435710fd..002082dea4 100644 --- a/local/recipes/drivers/redox-driver-core/source/src/manager.rs +++ b/local/recipes/drivers/redox-driver-core/source/src/manager.rs @@ -115,6 +115,16 @@ impl DeviceManager { .sort_by(|left, right| right.priority().cmp(&left.priority())); } + /// Register a driver via a pre-shared `Arc`. The caller + /// retains a clone/weak to the SAME allocation, so internal state + /// mutated through `&self` (e.g. DriverConfig's spawned/pid_to_device + /// maps) is observable by the caller. Used by driver-manager so the + /// SIGCHLD reaper sees the maps that `probe` actually populates. + pub fn register_driver_shared(&mut self, driver: std::sync::Arc) { + self.drivers.push(driver); + self.drivers.sort_by(|l, r| r.priority().cmp(&l.priority())); + } + /// Add a dynamic-ID entry for `driver_name`. The driver must already be /// registered (or be a candidate for deferred registration). The entry /// persists until [`remove_dynid`](Self::remove_dynid) or until the