<p>I'm making a Java application with an application-logic-thread and a database-access-thread.
Both of them persist for the entire lifetime of the application and both need to be running at the same time (one talks to the server, one talks to the user; when the app is fully started, I need <em>both</em> of them to work).</p>

<p>However, on startup, I need to make sure that initially the app thread waits until the db thread is ready (currently determined by polling a custom method <code>dbthread.isReady()</code>).
I wouldn't mind if app thread blocks until the db thread was ready.</p>

<p><code>Thread.join()</code> doesn't look like a solution - the db thread only exits at app shutdown.</p>

<p><code>while (!dbthread.isReady()) {}</code> kind of works, but the empty loop consumes a lot of processor cycles.</p>

<p>Any other ideas? Thanks.</p>

This applies to all languages:
You want to have an event/listener model.  You create a listener to wait for a particular event.  The event would be created (or signaled) in your worker thread.  This will block the thread until the signal is received instead of constantly polling to see if a condition is met, like the solution you currently have.
Your situation is one of the most common causes for deadlocks- make sure you signal the other thread regardless of errors that may have occurred.  Example- if your application throws an exception- and never calls the method to signal the other that things have completed.  This will make it so the other thread never 'wakes up'.
I suggest that you look into the concepts of using events and event handlers to better understand this paradigm before implementing your case.
Alternatively you can use a blocking function call using a mutex- which will cause the thread to wait for the resource to be free.  To do this you need good thread synchronization- such as:
```
```
Thread-A Locks lock-a
Run thread-B
Thread-B waits for lock-a
Thread-A unlocks lock-a (causing Thread-B to continue)
Thread-A waits for lock-b 
Thread-B completes and unlocks lock-b
```
```