Skip to main content

join_failed_start

Function join_failed_start 

Source
pub(crate) fn join_failed_start(
    slot: &Mutex<Option<JoinHandle<()>>>,
    inner: &Inner,
    spawned: ThreadId,
)
Expand description

Failed-start teardown: stop and join the thread spawned by THIS start attempt, but only if it still owns the slot.

A concurrent start may have already joined this thread and published a live replacement, which must not be torn down. The guard is an identity check: ThreadIds are never reused within a process, so it cannot false-match. When it does own the slot, the external stop is set INSIDE the lock before join(), matching every other join site (the set-before-join / lost-stop invariant).