l0.DependencyControl.FileLock¶
FileLock ¶
A cross-process advisory lock on a file. Usable as a cross-process lock primitive. Automatically released when the instance is garbage collected or when the process exits. However, unlike a semaphore, it cannot be forcibly taken from a process that is alive but hung.
Constructor ¶
Opens (creating if absent) the lock file and prepares it for locking.
| param | type | description |
|---|---|---|
| path | string |
Full path to the lock file. |
Instance methods¶
tryLock ¶
Attempts to acquire the lock without blocking.
Returns:
acquiredboolean— True if acquired.
unlock ¶
Releases the lock. Only the current holder should call this.
Returns:
issuedboolean— True if a release was issued.
Fields¶
| field | type | description |
|---|---|---|
| isAvailable | boolean |