当前位置:网站首页>Common methods of threads
Common methods of threads
2022-07-04 04:17:00 【InfoQ】
join()
public final synchronized void join(long millis) throws InterruptedException {
long base = System.currentTimeMillis();
long now = 0;
if (millis < 0) {
throw new IllegalArgumentException("timeout value is negative");
}
if (millis == 0) {
while (isAlive()) {
wait(0);
}
} else {
while (isAlive()) {
long delay = millis - now;
if (delay <= 0) {
break;
}
wait(delay);
now = System.currentTimeMillis() - base;
}
}
}
if (millis < 0) { throw new IllegalArgumentException("timeout value is negative");}if (millis == 0) { while (isAlive()) { wait(0); } }wait(delay);yield()
public static native void yield();
sleep()
public static native void sleep(long millis) throws InterruptedException;
wait() and wait(time)
public final void wait() throws InterruptedException {
wait(0);
}
public final native void wait(long timeout) throws InterruptedException;
边栏推荐
- idea修改主体颜色
- 【愚公系列】2022年7月 Go教学课程 002-Go语言环境安装
- Two commonly used graphics can easily realize data display
- leetcode刷题:二叉树09(二叉树的最小深度)
- 如何有效远程办公之我见 | 社区征文
- pytest多进程/多线程执行测试用例
- STM32外接DHT11显示温湿度
- Detailed explanation of PPTC self recovery fuse
- Mitsubishi M70 macro variable reading Mitsubishi M80 public variable acquisition Mitsubishi CNC variable reading acquisition Mitsubishi CNC remote tool compensation Mitsubishi machine tool online tool
- [Logitech] m720
猜你喜欢
![[Logitech] m720](/img/bb/44144a1c3907808398c05b3b36962c.png)
[Logitech] m720

02 ls 命令的具体实现

Detailed explanation of PPTC self recovery fuse

Distributed system: what, why, how

Pointer array and array pointer
![[csrf-01] basic principle and attack and defense of Cross Site Request Forgery vulnerability](/img/46/cb5a10ffe3fcdffb7da68dbaef5b1f.png)
[csrf-01] basic principle and attack and defense of Cross Site Request Forgery vulnerability

图解网络:什么是热备份路由器协议HSRP?

LNK2038 检测到“RuntimeLibrary”的不匹配项: 值“MD_DynamicRelease”不匹配值“MDd_DynamicDebug”(main.obj 中)

Brief explanation of depth first search (with basic questions)

There is a problem that the package cannot be parsed in the like project
随机推荐
Pandora IOT development board learning (HAL Library) - Experiment 6 independent watchdog experiment (learning notes)
Epidemic strikes -- Thinking about telecommuting | community essay solicitation
Reduce function under functools
A review of reverse reinforcement learning at Virginia Tech (VT)
[paddleseg source code reading] paddleseg custom data class
函数计算异步任务能力介绍 - 任务触发去重
Cesiumjs 2022^ source code interpretation [0] - article directory and source code engineering structure
透过JVM-SANDBOX源码,了解字节码增强技术原理
Two commonly used graphics can easily realize data display
Spa in SDP
Storage of MySQL database
JDBC advanced
渗透实战-SQLServer提权
Why is the probability of pod increasing after IPtable
[paddleseg source code reading] paddleseg calculation dice
pytest多进程/多线程执行测试用例
Evolution of MySQL database architecture
Sales management system of lightweight enterprises based on PHP
Flink学习6:编程模型
[csrf-01] basic principle and attack and defense of Cross Site Request Forgery vulnerability