File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Conditions that stop threads from executing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Conditions that stop threads from executing" Watch "Conditions that stop threads from executing" New topic

Conditions that stop threads from executing

Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
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
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
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.

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
wood burning stoves
subject: Conditions that stop threads from executing
jQuery in Action, 3rd edition