Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread Interaction

 
salih ayan
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1309
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 226
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Himai Minh
Ranch Hand
Posts: 1309
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic