pub fn update_in(
sessions_dir: &Path,
session_id: &str,
change: impl FnOnce(&mut SessionState),
) -> Result<SessionState, Box<dyn Error>>Expand description
Load, change and save a session’s state while holding an exclusive lock
on <session_id>.lock beside it, so the session’s parallel hooks — each
recording what it looked up — do not overwrite each other’s changes. The
lock is advisory: writers that do not take it (the interactive switch
commands) are as before. The OS releases it when the holder exits.