Inter Thread Communication

What are all the methods used for Inter Thread communication and what is the class in which these methods are defined?

Questions by renijoym

Editorial / Best Answer

maneesh.ce.2007  

  • Member Since Nov-2008 | Dec 15th, 2008


There are three ways in which Threads communicate with each other :

wait: It tells the calling thread to give up the monitor until some other thread enters the same monitor an calls Notify or Notifyall...

notify: It wakes up the first thread that called Wait() on the same object...

NotifyAll: It allows all the threads that called Wait() on the same object.The thread having the highest priority will run first...

Showing Answers 1 - 7 of 7 Answers

There are three ways in which Threads communicate with each other :

wait: It tells the calling thread to give up the monitor until some other thread enters the same monitor an calls Notify or Notifyall...

notify: It wakes up the first thread that called Wait() on the same object...

NotifyAll: It allows all the threads that called Wait() on the same object.The thread having the highest priority will run first...

satyanandr

  • Aug 25th, 2009
 

Two or more threads are communication via wait(), notify() and notifyAll() method of an Object class.

wait(): method will lock the monitor of the thread to not process.

notify(): method will wake the thead which undergoes waiting state, the wait state is waiting to called by notify or notifyAll()

notifyAll(): method will wake the theads which undergoes waiting state.

  Was this answer useful?  Yes

kutiarul

  • Nov 21st, 2009
 

Three methods are used. They are

1. wait() - makes one thread wait for some time till another thread is being executed
2. notify() - makes one wait process into ready state process
3. notifyall() - makes all the waiting processes into ready state processes

  Was this answer useful?  Yes

chakry

  • Nov 5th, 2011
 

why we use 'wait()' inside a synchronized method

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions