cargo::util

Module lockserver

source
Expand description

An implementation of IPC locks, guaranteed to be released if a process dies

This module implements a locking server/client where the main cargo fix process will start up a server and then all the client processes will connect to it. The main purpose of this file is to ensure that each crate (aka file entry point) is only fixed by one process at a time, currently concurrent fixes can’t happen.

The basic design here is to use a TCP server which is pretty portable across platforms. For simplicity it just uses threads as well. Clients connect to the main server, inform the server what its name is, and then wait for the server to give it the lock (aka write a byte).

Structs§