Condition Objects
Home ] Up ] Lock Objects ] ReentrantLock ] A ReentrantLock Example ] Finer Granularity ] [ Condition Objects ] Explicit Locks vs. synchronized ] Read/Write Locks ]

 

The Condition Interface
await()
signal() & signalAll()
An Example

 

So what happens if the "from" account doesn't have enough funds?

So far, we haven't considered this possibility. Let's now consider it.

If there are insufficient funds, we have two choices:

  1. Give up, and report the problem, never having transferred any funds, or
  2. Wait until there are sufficient funds, and then perform the transfer.

Let's say we choose the latter.  

This is a job for Condition Objects (a.k.a., for historical reasons, Condition Variables).  

 

The page was last updated February 19, 2008