Commit 7fc5004
authored
Update java-concurrent-questions-03.md
前面都说了await()是阻塞了,线程不是cas自旋等待state为0,而是阻塞依赖任务线程调用releaseShared()来唤醒,只有当最后一个线程releaseShared()使state为0,再唤醒主线程,主线程检测到state为0,才会从await()返回。以下为测试源码:
运行案例与源码分析:https://blog.csdn.net/m0_56602092/article/details/1317408161 parent e842996 commit 7fc5004
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
728 | 728 | | |
729 | 729 | | |
730 | 730 | | |
731 | | - | |
| 731 | + | |
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
| |||
0 commit comments