Provides advisory file locking using flock() or LockFileEx().

Static methods

@:value({ wait : true, exclusive : true })staticlock(path:String, exclusive:Bool = true, wait:Bool = true):FileLock

Acquires a lock on a file.

Parameters:

path

Path to the file.

exclusive

True for exclusive (write) lock, false for shared (read) lock.

wait

True to block until lock is acquired, false to fail immediately if locked.

Returns:

A FileLock instance if successful, null otherwise.

Methods

unlock():Void

Releases the lock.