Lock on a build directory, so that fpm processes working on the same package wait for each other instead of building over each other.
The lock is an exclusive OS lock on <build-dir>/.fpm-lock: flock on Unix,
LockFileEx on Windows. It belongs to the process, and all its OpenMP threads
work under it: acquire and release it in serial code, outside any parallel region.
The OS releases it when the process exits, also after an error stop or a crash,
so no stale lock is left behind. In the bootstrap build, which has no C, it does
nothing.
Lock on a build directory, held by the command that works on it. Release it on every way out of the command, before an error stop too. Do not copy a held lock: both copies would release it.
| final :: release_on_exit |
| procedure, public :: acquire | |
| procedure, public :: held | |
| procedure, public :: release |