File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What puts a thread in a waiting state?

 
Louie van Bommel
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the following three methods could put a thread in a waiting state: wait(), sleep(), join(). Is this true?

I seem to remember something that states there's a sleeping state. Or is this a subset of waiting state?

What state does yield() cause for the currently executing thread?
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yield puts a thread from running state back to runnable. From there the thread can go immediately back to running, or stay in runnable until it gets rescheduled to go back into running (that's because another thread gets a go at the cpu).
 
Robert Chisholm
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't forget that there is a "blocked on an object's lock" type of waiting that isn't so obvious.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic