The Java™ Tutorials — Concurrency :Joins 插入
来源:互联网 发布:榆林广电网络 编辑:程序博客网 时间:2024/06/06 09:21
The Java™ Tutorials — Concurrency :Joins 插入
原文地址:https://docs.oracle.com/javase/tutorial/essential/concurrency/join.html
关键点
- join定义:
t.join()
会引起当前线程暂停执行直到t线程执行完毕 - join也会抛出InterruptedException
- join的等待时间也是不精确的
全文翻译
The join method allows one thread to wait for the completion of another. If t is a Thread object whose thread is currently executing,
join 方法可以让一个线程等待另一线程的完成。如果t是一个Thread对象,而且为正在执行的对象,
t.join()
causes the current thread to pause execution until t’s thread terminates. Overloads of join allow the programmer to specify a waiting period. However, as with sleep, join is dependent on the OS for timing, so you should not assume that join will wait exactly as long as you specify.
会引起当前线程暂停执行直到t线程执行完毕。join的重载允许开发者指定等待时间。然而,同sleep一样,join的实际等待时间同样依赖于操作系统,所以你不应该假定join的等待时长会精确地等于你所指定的时间。
Like sleep, join responds to an interrupt by exiting with an InterruptedException.
类似sleep,join在响应中断时,会退出并抛出InterruptedException异常。
- The Java™ Tutorials — Concurrency :Joins 插入
- The Java™ Tutorials — Concurrency :前言
- The Java™ Tutorials — Concurrency :Executors
- The Java™ Tutorials — Concurrency :Thread Objects 线程对象
- The Java™ Tutorials — Concurrency :Interrupts 中断
- The Java™ Tutorials — Concurrency :Synchronization 同步
- The Java™ Tutorials — Concurrency :Thread Interference 线程冲突
- The Java™ Tutorials — Concurrency :Synchronized Methods 同步方法
- The Java™ Tutorials — Concurrency :Atomic Access 原子访问
- The Java™ Tutorials — Concurrency :Liveness 活跃度
- The Java™ Tutorials — Concurrency :Deadlock 死锁
- The Java™ Tutorials — Concurrency :Guarded Blocks 保护块
- The Java™ Tutorials — Concurrency :Lock Objects 锁对象
- #The Java™ Tutorials — Concurrency :High Level Concurrency Objects 高并发对象
- The Java™ Tutorials — Concurrency :The SimpleThreads Example SimpleThreads案例
- The Java™ Tutorials — Concurrency :Processes and Threads 进程和线程
- The Java™ Tutorials — Concurrency :Defining and Starting a Thread 线程的定义和启动
- The Java™ Tutorials — Concurrency :Pausing Execution with Sleep 利用Sleep暂停线程执行
- n&(n-1)的作用:将n的二进制表示中的最低位为1的改为0
- 1096: [ZJOI2007]仓库建设
- 并查集详解
- BZOJ 3632 外太空旅行 最大团
- 【CCF】201312-3 最大矩形
- The Java™ Tutorials — Concurrency :Joins 插入
- iOS --- 本地推送通知 UILocalNotification
- Hadoop mapreduce原理学习
- hadoop 配置项的调优
- (windows) Android ffmpeg 移植 cygwin+ndk-r8e+win7
- SERVLET体系结构和层次结构
- The Java™ Tutorials — Concurrency :The SimpleThreads Example SimpleThreads案例
- 沉寖式状态栏
- JAVA键盘事件监听(1)