Skip to main content

hand_off

Function hand_off 

Source
pub(crate) fn hand_off(memory: &Path, running: Option<File>, free: Duration)
Expand description

The exchanges’ lock let go between two short holds (in_short_holds, the copies beside drafts, “Remove its files” planning again): when an exchange of this process waits for it (a dose’s alarm, the window’s), the holder takes it again only once that one has taken it, or a second has passed, so that a waiter slow to wake (a loaded machine, a busy phone) never loses the hand to it again and again (CI’s macOS job of 20 October 2026: two holds back to back, 0.41 s). It stops waiting too as soon as fewer wait than when it let go: a waiter that gave up, or that lost the lock to another process, never keeps it a second (review of part 4, D-1a). With none waiting here, a moment (free: PUT_BACK_FREE between short holds; none for the copies beside drafts, which let go LET_GO between their batches and nothing after the last, D-1b): a waiter in another process (the command line, a phone’s background service) gets that moment alone, as before, since a file’s lock keeps no queue.