flix

0.67.2

Concurrent.ReentrantLock

enum ReentrantLockSource
case ReentrantLock(java.util.concurrent.locks.ReentrantLock)

A wrapper around a Java ReentrantLock.

Definitions

def isFair(lock: ReentrantLock): Bool Source

Returns true if this lock has fairness set true.

def lock(lock: ReentrantLock): Unit \ IO Source

Acquires the lock.

def lockInterruptibly(lock: ReentrantLock): Result[java.lang.InterruptedException, Unit] \ IO Source

Acquires the lock unless the current thread is interrupted.

def newCondition(lock: ReentrantLock): Condition \ IO Source

Returns a Condition instance for use with this Lock instance.

def newLock(fair: Bool): ReentrantLock \ IO Source

Creates an instance of ReentrantLock with the given fairness policy. fair = False is the default for Java.

def tryLock(lock: ReentrantLock): Bool \ IO Source

Acquires the lock only if it is not held by another thread at the time of invocation.

def tryLockNanos(lock: ReentrantLock, nanosTimeout: Int64): Result[java.lang.InterruptedException, Bool] \ IO Source

Acquires the lock if it is not held by another thread within the given waiting time (nanos) and the current thread has not been interrupted.

def unlock(lock: ReentrantLock): Result[java.lang.IllegalMonitorStateException, Unit] \ IO Source

Attempts to release this lock.