user1104939
user1104939

Reputation: 1425

Waiting for a response in a thread

I want to recycle my image , but since another thread is rendering them, I need to be sure that the rendering has stopped:

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

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

Upvotes: 0

Views: 95

Answers (1)

Akhil
Akhil

Reputation: 14038

Use thread wait()/notify() mechanism. you will find lots of nice tuts on the web

Upvotes: 1

Related Questions