public class FileLock implements AutoClosable
Exclusive cooperative interprocess lock on a dedicated lock file. Acquisition waits for the previous holder; the OS releases the lock if the process exits. All writers must use the same lock path. Never delete or replace that file.
try guard = FileLock(Path("settings.lock")):
Files.writeTextAtomic(Path("settings.json"), "{}")| Modifier and Type | Member | Description |
|---|---|---|
| public | FileLock | Acquires the lock, creating its file if necessary. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | closeclose() as Void |
Releases this lock; repeated calls are harmless. |