[#util-LockDirectory] = xref:util.adoc[util]::LockDirectory :relfileprefix: ../ :mrdocs: Acquire an exclusive lock on a directory via a lock file. == Synopsis Declared in `<util/fs_helpers.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] xref:util/LockResult.adoc[LockResult] LockDirectory( xref:fs/path.adoc[fs::path] const& directory, xref:fs/path.adoc[fs::path] const& lockfile_name, bool probe_only = false); ---- == Return Value A LockResult describing whether the lock was acquired. [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | 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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#