简体   繁体   English

Java中的守护程序和非守护程序线程优先级

[英]Daemon and non-daemon thread priority in Java

I know how the JVM treats daemon and non-daemon threads when the main thread terminates. 我知道当主线程终止时,JVM如何处理守护程序线程和非守护程序线程。 I wonder if there is any difference in priority of daemon and non-daemon threads? 我想知道守护程序和非守护程序线程的优先级是否有区别?

No there is no difference in priority between Daemon and non-daemon thread priority in Java, you can define priority or it will be inherited from parent Java中的守护程序和非守护程序线程优先级之间的优先级没有区别,您可以定义优先级,也可以从父级继承

From JavaDoc : 从JavaDoc:

The priority of the newly created thread is set equal to the priority of the thread creating it, that is, the currently running thread 新创建的线程的优先级设置为等于创建它的线程的优先级,即当前正在运行的线程

Oracle Java Doc Oracle Java文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM