Function admit_sop_driver
pub fn admit_sop_driver<F>(
handles: &Arc<Mutex<SopDriverRegistry>>,
spawn: F,
) -> boolExpand description
Admit a headless driver into a generation-owned handle set, creating the task only once the generation has accepted it.
spawn is called while the registry lock is held, so the admission check
and the task’s creation are one indivisible step that close_and_take
cannot interleave with. That ordering is the whole point. Spawning first and
registering afterwards leaves a window in which Tokio can poll the driver
before registration discovers the generation is closed: the rejected driver
can already be mutating the SOP engine under superseded configuration and
permissions. Cancelling it afterwards does not close that window either,
because abort only requests cancellation at the next await point — a
driver that reaches none would have to be abandoned mid-flight.
Returns false when the set is already closed, in which case spawn is
never called. No task exists to cancel, own, or lose: the work is refused
before its body can run, which is the guarantee the generation boundary
needs. Prunes finished entries on the way in so a long-lived daemon does not
accumulate them.