Acquire an exclusive lock on a directory via a lock file.

Synopsis

Declared in <util/fs_helpers.h>

[[nodiscard]]
LockResult
LockDirectory(
    fs::path const& directory,
    fs::path const& lockfile_name,
    bool probe_only = false);

Return Value

A LockResult describing whether the lock was acquired.

Note

The return value should not be discarded.

Parameters

Name

Description

directory [in]

The directory to lock.

lockfile_name [in]

The name of the lock file to create inside the directory.

probe_only [in]

If true, test whether the lock can be taken without holding it.

Created with MrDocs