守护程序线程和非守护程序线程。 [英] Daemon Thread and Non-Daemon Thread.

查看:91
本文介绍了守护程序线程和非守护程序线程。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

展开 | 选择 | Wrap | 行号

解决方案

在Thread API文档的开头附近:

< blockquote class =post_quotes>
每个线程可能也可能不会被标记为守护进程。当在某个线程中运行的代码创建一个新的Thread对象时,新线程的优先级最初设置为等于创建线程的优先级,并且当且仅当创建线程是守护进程时才是守护进程线程。


当Java虚拟机启动时,通常会有一个非守护程序线程(通常调用某个指定类的名为main的方法)。



亲切的问候,


Jos


嗯......

我有一些线程的定义。守护进程意味着恶魔(违反正常行为)。是吗?
守护程序线程:它不会阻止程序结束。这意味着如果想要停止然后守护程序线程不会阻止它结束。

我的概念在这里有什么问题吗?

这里的术语程序,这是什么意思?请澄清我!


在我的情况下,新线程是守护进程或非守护进程,为什么?


上面引用文本的哪些部分做你不明白吗?


你不知道程序是什么?


Expand|Select|Wrap|Line Numbers

解决方案

Near the start of the Thread API documentation:

Each thread may or may not also be marked as a daemon. When code running in some thread creates a new Thread object, the new thread has its priority initially set equal to the priority of the creating thread, and is a daemon thread if and only if the creating thread is a daemon.

When a Java Virtual Machine starts up, there is usually a single non-daemon thread (which typically calls the method named main of some designated class).

kind regards,

Jos


Well ....
I have some definitions of threads. Daemon means Devil(violates the normal actions). Is it?
Daemon Thread: It won''t prevent program from ending. That means if the wants to stop and then Daemon Thread won''t stop it from ending.
Anything wrong in my conception here?
Here the term program, what does it mean? Please clarify me!

In my case the New Thread is Daemon or Non-Daemon and Why?


Which parts of the quoted text above do you not understand?

You don''t know what a program is??


这篇关于守护程序线程和非守护程序线程。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆