当前位置:网站首页>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;
边栏推荐
- Database SQL statement summary, continuous update
- 02 ls 命令的具体实现
- Why is the probability of pod increasing after IPtable
- Perf simple process for multithreaded profile
- 【读书会第十三期】视频文件的封装格式
- “软硬皆施”,助力建成新型云计算数据中心
- Idea configuration 360zip open by default -- external tools
- Interpretation of leveldb source code skiplist
- Flink学习6:编程模型
- Katalon框架测试web(二十一)获取元素属性断言
猜你喜欢

指针数组和数组指针

Evolution of MySQL database architecture

I Build a simple microservice project

The maximum expiration time of client secret in azure ad application registration is modified to 2 years

ctf-pikachu-XSS

用于TCP协议交互的TCPClientDemo

EV6 helps the product matrix, and Kia is making efforts in the high-end market. The global sales target in 2022 is 3.15 million?

Katalon framework test web (XXVI) automatic email

*. No main manifest attribute in jar

10 reasons for not choosing to use free virtual hosts
随机推荐
02 ls 命令的具体实现
The maximum expiration time of client secret in azure ad application registration is modified to 2 years
Pandora IOT development board learning (HAL Library) - Experiment 6 independent watchdog experiment (learning notes)
Class summation, shortest row
SQL statement strengthening exercise (MySQL 8.0 as an example)
Mindmanager2022 efficient and easy to use office mind map MindManager
还原窗口位置的微妙之处
Flink学习8:数据的一致性
2021 RSC | Drug–target affinity prediction using graph neural network and contact maps
[paddleseg source code reading] paddleseg custom data class
华为云鲲鹏工程师培训(广西大学)
Is it safe to buy insurance for your children online? Do you want to buy a million dollar medical insurance for your children?
指针数组和数组指针
CesiumJS 2022^ 源码解读[0] - 文章目录与源码工程结构
mysql数据库的存储
*. No main manifest attribute in jar
Huawei cloud Kunpeng engineer training (Guangxi University)
leetcode刷题:二叉树09(二叉树的最小深度)
【罗技】m720
疫情来袭--远程办公之思考|社区征文