当前位置:网站首页>Thread start and priority
Thread start and priority
2022-07-03 00:44:00 【InfoQ】
start() and run() The difference between
public synchronized void start() {
if (threadStatus != 0)
throw new IllegalThreadStateException();
group.add(this);
boolean started = false;
try {
start0();
started = true;
} finally {
try {
if (!started) {
group.threadStartFailed(this);
}
} catch (Throwable ignore) {
// Don't handle any exceptions , If start0 Throw an exception , Then it will be passed to the call stack
}
}
}
if (threadStatus != 0) throw new IllegalThreadStateException();group.add(this);catch (Throwable ignore) { }public class Thread implements Runnable {
......
private Runnable target;
@Override
public void run() {
if (target != null) {
target.run();
}
}
}
Thread priority
public final static int MIN_PRIORITY = 1;
public final static int NORM_PRIORITY = 5;
public final static int MAX_PRIORITY = 10
public final void setPriority(int newPriority) {
ThreadGroup g;
checkAccess();
if (newPriority > MAX_PRIORITY || newPriority < MIN_PRIORITY) {
throw new IllegalArgumentException();
}
if((g = getThreadGroup()) != null) {
if (newPriority > g.getMaxPriority()) {
newPriority = g.getMaxPriority();
}
setPriority0(priority = newPriority);
}
}
if (newPriority > MAX_PRIORITY || newPriority < MIN_PRIORITY) { } if (newPriority > g.getMaxPriority()) { newPriority = g.getMaxPriority();}边栏推荐
- Tensorflow 2.x(keras)源码详解之第十五章:迁移学习与微调
- Nc20806 District interval
- 【Pulsar文档】概念和架构/Concepts and Architecture
- Hdu3507 (slope DP entry)
- Solution to the problem of abnormal display of PDF exported Chinese documents of confluence
- 利亚德:Micro LED 产品消费端首先针对 100 英寸以上电视,现阶段进入更小尺寸还有难度
- 文件操作IO-Part2
- Two common methods and steps of character device registration
- leetcode-2280:表示一个折线图的最少线段数
- 【AutoSAR 七 工具链简介】
猜你喜欢

Attributeerror: 'tuple' object has no attribute 'layer' problem solving

2022 list of manufacturers of Chinese 3D vision enterprises (guided positioning and sorting scenes)

【AutoSAR 十一 通信相关机制】

antv x6节点拖拽到画布上后的回调事件(踩大坑记录)
![[IELTS reading] Wang Xiwei reading P1 (reading judgment question)](/img/ee/540661fcb2cf1cf1eb15e2026c997a.png)
[IELTS reading] Wang Xiwei reading P1 (reading judgment question)

字符设备注册常用的两种方法和步骤

FAQ | FAQ for building applications for large screen devices

Two common methods and steps of character device registration

多进程编程(二):管道

The "2022 China Digital Office Market Research Report" can be downloaded to explain the 176.8 billion yuan market in detail
随机推荐
Vulkan并非“灵药“
File operation io-part2
[MCU project training] eight way answering machine
lex && yacc && bison && flex 配置的问题
程序分析与优化 - 9 附录 XLA的缓冲区指派
Kubernetes simple introduction to writing YML
NC24840 [USACO 2009 Mar S]Look Up
2022上半年值得被看见的10条文案,每一句都能带给你力量!
Multiprocess programming (I): basic concepts
Multi process programming (III): message queue
Vulkan practice first bullet
[jetcache] jetcache configuration description and annotation attribute description
【JetCache】JetCache的配置说明和注解属性说明
Nc50528 sliding window
Rust string slicing, structs, and enumeration classes
Leetcode 294. Flip game II (game theory)
Shell implements basic file operations (SED edit, awk match)
Callback event after the antv X6 node is dragged onto the canvas (stepping on a big hole record)
Liad: the consumer end of micro LED products is first targeted at TVs above 100 inches. At this stage, it is still difficult to enter a smaller size
helm 基础学习