Lock

abstract class Lock : AutoCloseable

An interprocess mutex lock.

Typical use might look like:

directory.obtainLock("my.lock").use { lock ->
// ... code to execute while locked ...
}

See also

Inheritors

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
abstract override fun close()

Releases exclusive access.

Link copied to clipboard
abstract fun ensureValid()

Best effort check that this lock is still valid. Locks could become invalidated externally for a number of reasons, for example if a user deletes the lock file manually or when a network filesystem is in use.