当前位置:网站首页>线程常用的方法
线程常用的方法
2022-07-04 03:50: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()和wait(time)
public final void wait() throws InterruptedException {
wait(0);
}
public final native void wait(long timeout) throws InterruptedException;
边栏推荐
- Katalon framework test web (XXVI) automatic email
- 【愚公系列】2022年7月 Go教学课程 002-Go语言环境安装
- Pytest multi process / multi thread execution test case
- Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
- Recursive structure
- Epidemic strikes -- Thinking about telecommuting | community essay solicitation
- Huawei cloud Kunpeng engineer training (Guangxi University)
- 图解网络:什么是热备份路由器协议HSRP?
- Objective C attribute keyword
- Katalon framework tests web (XXI) to obtain element attribute assertions
猜你喜欢

渗透实战-guest账户-mimikatz-向日葵-sql提权-离线解密

Sales management system of lightweight enterprises based on PHP

Katalon framework test web (XXVI) automatic email

JVM family -- heap analysis

Katalon中控件的参数化

pytest多进程/多线程执行测试用例

【CSRF-01】跨站请求伪造漏洞基础原理及攻防

Unity移动端游戏性能优化简谱之 画面表现与GPU压力的权衡
![Cesiumjs 2022^ source code interpretation [0] - article directory and source code engineering structure](/img/ba/c1d40de154344ccc9f2fd1dd4cb12f.png)
Cesiumjs 2022^ source code interpretation [0] - article directory and source code engineering structure

三菱M70宏变量读取三菱M80公共变量采集三菱CNC变量读取采集三菱CNC远程刀补三菱机床在线刀补三菱数控在线测量
随机推荐
Katalon使用script实现查询List大小
选择排序与冒泡排序模板
Two commonly used graphics can easily realize data display
PostgreSQL users cannot create table configurations by themselves
Penetration practice - sqlserver empowerment
How was my life in 2021
数据库SQL语句汇总,持续更新......
Third party login initial version
STM32外接DHT11显示温湿度
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
Unity移动端游戏性能优化简谱之 画面表现与GPU压力的权衡
There is a problem that the package cannot be parsed in the like project
【罗技】m720
Rhcsa-- day one
Simple dialogue system -- text classification using transformer
SDP中的SPA
pytest多进程/多线程执行测试用例
JSON string conversion in unity
Cesiumjs 2022^ source code interpretation [0] - article directory and source code engineering structure
functools下的reduce函数