Thread 的join
来源:互联网 发布:淘宝托鞋 编辑:程序博客网 时间:2024/05/13 06:36
Context:
threadObject:为Thread对象(以下代指)
Thread的Join方法:
1.会暂停当前的线程,运行调用该方法的Thread对象 对应的线程。
注意点:
1.Thread内部有个判断isAlive() 判断,注释是Tests if this thread is alive. A thread is alive if it has been started and has not yet died.也就是说在Thread对象之前没有threadObject.start(),threadObject.join()是肯定不会运行的。另外如果threadObject已经执行完了,threadObject.join()也不会有作用。
Tips:
1.当调用threadObject.interrupt()后,并不会立即终止threadObject所对应的线程。所以为了保证尽快终止,可以立即调用threadObject.join()方法让它尽快运行,之后终止。
0 0
- thread.join()的用法
- Thread Join()的用法
- thread join 的尝试
- Thread类的join()
- Thread的join()
- Thread的join()方法
- Thread 的join
- thread.join() 的用法
- Thread的join()方法
- Thread.join()的使用
- thread.join()的实例
- Thread.join()的用法
- Thread.join()的使用
- Thread的join方法
- Thread Join()的用法
- thread join 的用法
- Thread.join()的使用
- [Thread] 執行緒的順序啟動 - Thread.Join方法
- Swift:Generators 与 Sequences 浅析
- DataTable 与list 互转
- 匿名函数
- 从头到尾理解KMP
- #pragma pack(push,1) & #pragma pack(pop)
- Thread 的join
- 两个有序线性表的合并(线性表使用 Vector表示)
- linux命令之分割命令:split
- Android-多线程断点下载详解及源码下载(二)
- Binary Tree Level Order Traversal II
- hihoCoder 1107 Shortest Proper Prefix (字典树的遍历)
- getParameter和getAttribute的区别
- myeclipse console中文乱码
- stl容器的区别:vector list deque set map-底层实现