Java线程 Block和Waiting的异同

Java线程 Block和Waiting的异同

可以参考文章

http://stackoverflow.com/questions/2534147/java-thread-wait-blocked

我的理解

1 相同点

线程都不是运行状态

2 不同点

waiting是在资源的等待队列中,等待被notify,notify后将会到Runable状态,

但是要想运行还得过monitor这关。

参考

In other words, both BLOCKED and WAITING are status of inactive threads, but a WAITING thread cannot be RUNNABLE without going to BLOCKED first. WAITING threads "don't want" to become active, whereas BLOCKED threads "want" to, but can't, because it isn't their turn.

你可能感兴趣的:(jdkapi)