class DaemonController::LockFile

A lock file is a synchronization mechanism, like a Mutex, but it also allows inter-process synchronization (as opposed to only inter-thread synchronization within a single process).

Processes can obtain either a shared lock or an exclusive lock. It’s possible for multiple processes to obtain a shared lock on a file as long as no exclusive lock has been obtained by a process. If a process has obtained an exclusive lock, then no other processes can lock the file, whether they’re trying to obtain a shared lock or an exclusive lock.

Note that on JRuby, LockFile can only guarantee synchronization between threads if the different threads use the same LockFile object. Specifying the same filename is not enough.