• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Conditions that stop threads from executing

 
Joyce Lee
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
According to knB of page 508, it mentions that "stopping threads from executing" means "moving a thread to a nonrunnable state".
Could someone advise me if I'm right with the following statements?
Conditions that stop a thread from executing:
sleep(), wait(), join(), blocked because it needs an object locks
Conditions NOT counted as stopping a thread from executing:
yield(), another thread is given higher priority
Thanks
Joyce
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm.. yes, yield() does not guarantee that the thread will move from the running to runnable state. And if it does, the same thread might be chosen again to the running state.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic