ReentrantLock

zio.concurrent.ReentrantLock
See theReentrantLock companion object
final class ReentrantLock

Attributes

Companion
object
Source
ReentrantLock.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def hasQueuedFiber(fiberId: FiberId): UIO[Boolean]

Queries whether the given fiber is waiting to acquire this lock.

Queries whether the given fiber is waiting to acquire this lock.

Attributes

Source
ReentrantLock.scala

Returns true if this lock has fairness set to true.

Returns true if this lock has fairness set to true.

Attributes

Source
ReentrantLock.scala

Concrete fields

Queries whether any fibers are waiting to acquire this lock.

Queries whether any fibers are waiting to acquire this lock.

Attributes

Source
ReentrantLock.scala
lazy val holdCount: UIO[Int]

Queries the number of holds on this lock by the current fiber.

Queries the number of holds on this lock by the current fiber.

Attributes

Source
ReentrantLock.scala

Queries if this lock is held by the current fiber.

Queries if this lock is held by the current fiber.

Attributes

Source
ReentrantLock.scala
lazy val lock: UIO[Unit]

Acquires the lock.

Acquires the lock.

Acquires the lock if it is not held by another fiber and returns immediately, setting the lock hold count to one.

If the current fiber already holds the lock then the hold count is incremented by one and the method returns immediately.

If the lock is held by another fiber then the current fiber is put to sleep until the lock has been acquired, at which time the lock hold count is set to one.

Attributes

Source
ReentrantLock.scala
lazy val locked: UIO[Boolean]

Queries if this lock is held by any fiber.

Queries if this lock is held by any fiber.

Attributes

Source
ReentrantLock.scala
lazy val owner: UIO[Option[FiberId]]

Returns the fiber ID of the fiber that currently owns this lock, if owned, or None otherwise.

Returns the fiber ID of the fiber that currently owns this lock, if owned, or None otherwise.

Attributes

Source
ReentrantLock.scala
lazy val queueLength: UIO[Int]

Returns the number of fibers waiting to acquire this lock.

Returns the number of fibers waiting to acquire this lock.

Attributes

Source
ReentrantLock.scala

Returns the fiber IDs of the fibers that are waiting to acquire this lock.

Returns the fiber IDs of the fibers that are waiting to acquire this lock.

Attributes

Source
ReentrantLock.scala
lazy val tryLock: UIO[Boolean]

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

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

Attributes

Source
ReentrantLock.scala
lazy val unlock: UIO[Unit]

Attempts to release this lock.

Attempts to release this lock.

If the current fiber is the holder of this lock then the hold count is decremented. If the hold count is now zero then the lock is released. If the current thread is not the holder of this lock then nothing happens.

Attributes

Source
ReentrantLock.scala
lazy val withLock: URIO[Scope, Int]

Acquires and releases the lock as a managed effect.

Acquires and releases the lock as a managed effect.

Attributes

Source
ReentrantLock.scala