Skip to main content

settle_locks

Function settle_locks 

Source
pub fn settle_locks(
    child: Child,
    collected: bool,
    tree: Vec<TreeMember>,
    locks: LockLedger,
    grace: Duration,
) -> Option<JoinHandle<()>>
Expand description

What: Remove the locks of a stopped tree now when it has ended, or on a thread of its own when it has not. Why: A killed process ends only when the kernel has run it once more, which a loaded or stalled host may not do within the grace; a sweep before that finds the tree running and removes nothing, and nothing would try again. The thread waits for the whole tree and then sweeps. Returns the thread, if one was started.

In TS you’d write (pseudocode):

if (collected && allEnded(tree)) { locks.sweep(tree.as_slice()); return undefined; } return sweepAfterExit(child, tree, locks);