jQuery in Action, 2nd edition
The moose likes Threads and Synchronization and the fly likes difference between wait state and block state Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "difference between wait state and block state" Watch "difference between wait state and block state" New topic
Author

difference between wait state and block state

puff li
Greenhorn

Joined: Jul 28, 2010
Posts: 22
Hi,

What is the difference between wait and block state of a thread?

Thanks in advance.
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

wait state means, the thread waits for acquiring the lock of that object. But block state means, the thread is blocked for a period not doing any thing!


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
puff li
Greenhorn

Joined: Jul 28, 2010
Posts: 22
Then, if a thread A calls B.join(), should A be in wait state or block state?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

li hao wrote:Then, if a thread A calls B.join(), should A be in wait state or block state?


http://download-llnw.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.State.html

now you understand the state of your *waiting* thread A?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: difference between wait state and block state
 
Similar Threads
difference between wait() and sleep()
Livelock same as race condition?
Clarification in wait, notify and notifyAll methods
static synchronized block
Difference between wait and join