class Latch extends AnyRef
A synchronization object that supports threads waiting until a fixed number of operations being performed in other threads have been completed.
A Latch
is initialized with a given count. The await
methods block until the current count reaches zero through
decrement
invocations, after which all waiting threads
are allowed to proceed and any subsequent invocations of
await
return immediately. This happens exactly once per
latch: its count cannot be reset.
If the latch is strict then any decrement
calls subsequent
to the one that makes the count zero will raise an
IllegalStateException
.
- Alphabetic
- By Inheritance
- Latch
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Latch(count: Int, name: String = null, strict: Boolean = true)
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
await(): Unit
Causes the current thread to wait until the latch has counted down to zero.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
decrement(): Unit
Decrements the count, allowing all awaiting threads to proceed if the count thereby reaches zero.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
getCount: Int
Return the current value of the count.
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- var name: String
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- Latch → AnyRef → Any
-
def
tryAwait(timeoutNS: Long): Boolean
Causes the current thread to wait until the latch has counted down to zero (returning true) or until the specified timeout has elapsed (returning false).
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )