class StampedLockWithHandle extends AnyRef
A stamped lock that allows passing around a lock handle to better guard methods that should only be called with an active lock.
For example:
object Foo { val lock = new StampedLockWithHandle() def bar() = lockWithWriteLockHandle { implicit writeLock => // do something baz() // do more stuff } def baz()(implicit writeLockHandle: lock.WriteLockHandle) = { // do some more stuff } }
In the above example, baz
cannot be called unless a write lock was acquired specifically only
with lock
.
- Alphabetic
- By Inheritance
- StampedLockWithHandle
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new StampedLockWithHandle()
Type Members
- class ReadLockHandle extends AnyRef
- class WriteLockHandle extends AnyRef
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val lock: StampedLock
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def readLock(): ReadLockHandle
Acquire a read lock, blocking if it's currently not possible.
Acquire a read lock, blocking if it's currently not possible.
- returns
A read lock handle with which the lock can be unlocked again.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unlockRead(readLockHandle: ReadLockHandle): Unit
Unlock a previously acquired read lock.
- def unlockWrite(writeLockHandle: WriteLockHandle): Unit
Unlock a previously acquired write lock.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withReadLock[A](fn: => A): A
Run a block of code within a read lock.
- def withReadLock[A, F[_]](fn: => F[A])(implicit arg0: Thereafter[F]): F[A]
Run a block of code within a read lock.
- def withReadLockHandle[A, F[_]](fn: (ReadLockHandle) => F[A])(implicit arg0: Thereafter[F]): F[A]
Run a block of code within a read lock, providing the acquired read lock handle.
- def withWriteLock[A, F[_]](fn: => F[A])(implicit arg0: Thereafter[F]): F[A]
Run a block of code within a write lock, providing the acquired write lock handle.
- def withWriteLockHandle[A, F[_]](fn: (WriteLockHandle) => F[A])(implicit arg0: Thereafter[F]): F[A]
Run a block of code within a write lock, providing the acquired write lock handle.
- def writeLock(): WriteLockHandle
Acquire a write lock, blocking if it's currently not possible.
Acquire a write lock, blocking if it's currently not possible.
- returns
A write lock handle with which the lock can be unlocked again.