Waiting for a response in a thread
<p>I want to recycle my image , but since another thread is rendering them, I need to be sure that the rendering has stopped:</p>

<pre><code>     private void unload() {
        System.out.println("Unloading menu...");
        loaded = false;
        while(rendering) {
            //wait
        }
        background.recycle();  
        button.recycle();
        button_pushed.recycle();
     }
</code></pre>

<p>But I dont think this is the best way , are their other ways to do this?</p>
