Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread Interaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread Interaction" Watch "Thread Interaction" New topic
Author

Thread Interaction

salih ayan
Ranch Hand

Joined: Apr 23, 2013
Posts: 59
Hi to all.
l am reading K&B book.There are something in "Thread Interaction" part which l could not understand.

in same part (Thread Interaction) l have read some sentences confused my mind.

For instance below sentence;

- The Object class has three methods, wait(), notify(), and notifyAll() that help threads
communicate about the status of an event that the threads care about.


in the above sentence specially l didnt understand
what K&B book wants to express by saying "status of an event that the threads care about"

What does K&B book want to express by saying "status of an event".
In that sentence what is event.
Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 721
I believe the status of event means :
1. the event that one thread wait for a resources.
2. the event that one thread notifies the other thread that is waiting for the resource.
3. the even that one thread notifies all other threads that are waiting for the resource.
Nick Widelec
Ranch Hand

Joined: Feb 28, 2013
Posts: 226

Himai Minh wrote:I believe the status of event means :
1. the event that one thread wait for a resources.
2. the event that one thread notifies the other thread that is waiting for the resource.
3. the even that one thread notifies all other threads that are waiting for the resource.


Plus I would add to go thorugh the Thread states http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.State.html

OCAJP 7, OCPJP 7
Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 721
Try to read this threading example :
http://www.avajava.com/tutorials/lessons/how-do-i-use-the-wait-and-notify-methods.html

Let us know if you have a question about it.
 
Consider Paul's rocket mass heater.
 
subject: Thread Interaction
 
Similar Threads
Mapraputa Is
what is object's lock
Threads: Confusion about wait()
The Thread Scheduler
Threads (blocked state)