lockFile

Obtain a lock for a file at the given path. If the file cannot be locked within the given duration, an exception is thrown. The file will be created if it does not yet exist. Deleting the file is not safe as another process could create a new file with the same name. The returned lock will get unlocked upon destruction.

lockFile
(
string path
,
Duration timeout = dur!"msecs"(500)
)

Parameters

path
Type: string

path to file that gets locked

timeout
Type: Duration

duration after which locking failed

Return Value

Type: auto

The locked file or an Exception on timeout.

Meta