[#util-LockDirectory]
= xref:util.adoc[util]::LockDirectory
:relfileprefix: ../
:mrdocs:

Acquire an exclusive lock on a directory via a lock file&period;

== Synopsis

Declared in `&lt;util&sol;fs&lowbar;helpers&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
xref:util/LockResult.adoc[LockResult]
LockDirectory(
    xref:fs/path.adoc[fs::path] const& directory,
    xref:fs/path.adoc[fs::path] const& lockfile&lowbar;name,
    bool probe&lowbar;only = false);
----

== Return Value

A LockResult describing whether the lock was acquired&period;

[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&period;
| *lockfile&lowbar;name* [in]
| The name of the lock file to create inside the directory&period;
| *probe&lowbar;only* [in]
| If true, test whether the lock can be taken without holding it&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
