Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread

 
Steven Wong
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
1. Is the wait and notify method called on the thread or on the object?
2. Is it also possible that a thread in the waiting state, never get executed even ater the notify method has called upon it?
Clement
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Clement
1. wait and notify are instance methods of the Object class so they are called on objects not on the class themselves. These methods are called on instances of type Thread.
2. first, you can't call notify on a specific Thread. It is possible that a Thread that had been waiting for a certain condition can get woken up but not executed becasue the condition still has not been met.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic