previous
|
start
|
next
Condition Objects
Calling
await
Makes current thread wait
Allows another thread to acquire the lock object
To unblock, another thread must execute
signalAll
on the same condition object
sufficientFundsCondition.signalAll();
signalAll
unblocks all threads waiting on the condition
signal
: randomly picks just one thread waiting on the object and unblocks it
signal
can be more efficient, but you need to know that every waiting thread can proceed
Recommendation: always call
signalAll
previous
|
start
|
next