Two Laptop Bag*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
I agree. Here's the link:
subject: Conditions that stop threads from executing
Similar Threads
Threads Question.
Threads and JVM
Stopping and starting thread for multiple key clicks
Which methods may cause a thread to stop executing?