35

深入剖析线程同步工具CountDownLatch原理-wx5c6bcb1723ec5的博客

 4 years ago
source link: https://blog.51cto.com/14207399/2415502
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
0CountDownLatch的作用CountDownLatch作为一个多线程间的同步工具,它允许一个或多个线程等待其他线程(可以是多个)完成工作后,再恢复执行。就像下面这样:1从一个Demo说起我们直接拿源码中给出的Demo看一下,源码中的这个demo可以看做模拟一个赛跑的场景。赛跑肯定有跑得快的运动员也有跑的慢的运动员,每个运动员就表示一个线程。运动员听到枪声后开始起跑,而最后一个运动员到达终

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK