首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

透过Thread.join()和CountDownLatch来实现进程同步

2013-10-01 
通过Thread.join()和CountDownLatch来实现进程同步1.Thread.join()如果在一个进程,如main中调用另一个thre

通过Thread.join()和CountDownLatch来实现进程同步

1.Thread.join()

如果在一个进程,如main中调用另一个thread的join()函数会导致main函数阻塞,直至thread执行完毕。

Thread-1starts.Thread-4starts.Thread-0starts.all threads end.Thread-2starts.Thread-3starts.Thread-3 ends.Thread-1 ends.Thread-4 ends.Thread-0 ends.Thread-2 ends.









热点排行