public class CondVar
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.locks.Condition |
cond |
protected java.util.concurrent.locks.Lock |
lock |
Constructor and Description |
---|
CondVar() |
CondVar(java.util.concurrent.locks.Lock lock) |
Modifier and Type | Method and Description |
---|---|
void |
signal(boolean signal_all)
Wakes up one (signal_all=false) or all (signal_all=true) blocked threads.
|
void |
waitFor(Condition condition)
Blocks until condition is true.
|
boolean |
waitFor(Condition condition,
long timeout,
java.util.concurrent.TimeUnit unit)
Blocks until condition is true or the time elapsed
|
protected final java.util.concurrent.locks.Lock lock
protected final java.util.concurrent.locks.Condition cond
public CondVar()
public CondVar(java.util.concurrent.locks.Lock lock)
public void waitFor(Condition condition)
condition
- The condition. Must be non-nullpublic boolean waitFor(Condition condition, long timeout, java.util.concurrent.TimeUnit unit)
condition
- The conditiontimeout
- The timeout to wait. A value <= 0 causes immediate returnunit
- TimeUnitpublic void signal(boolean signal_all)
signal_all
- Copyright © 1998-2020 Red Hat. All Rights Reserved.