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.
Release the lock when it goes out of scope, as on a return from the command that holds it. Compilers that do not finalize local variables, like gfortran before 13, skip this, so commands release the lock themselves as well.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(build_lock_t), | intent(inout) | :: | self |
Lock the build directory build_dir, creating it if needed. While another
fpm process holds the lock, say so and wait for it. If the lock cannot be
taken, warn and go on without it. Does nothing if this lock is already held.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(build_lock_t), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | build_dir |
Whether this lock is held
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(build_lock_t), | intent(in) | :: | self |
Release the lock, if held
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(build_lock_t), | intent(inout) | :: | self |
type :: build_lock_t private !> Descriptor of the lock file (its HANDLE on Windows), -1 when not held integer(kind=c_intptr_t) :: handle = -1 contains procedure :: acquire procedure :: release procedure :: held final :: release_on_exit end type build_lock_t