Skip to content

Commit

Permalink
Merge pull request CyC2018#729 from Sanarous/patch-1
Browse files Browse the repository at this point in the history
修改Java并发守护线程部分
  • Loading branch information
CyC2018 authored Jun 20, 2019
2 parents d3f445a + c937deb commit 92c4bab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion notes/Java 并发.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,13 @@ public static void main(String[] args) {

main() 属于非守护线程。

使用 setDaemon() 方法将一个线程设置为守护线程
在线程启动之前使用 setDaemon() 方法可以将一个线程设置为守护线程

```java
public static void main(String[] args) {
Thread thread = new Thread(new MyRunnable());
thread.setDaemon(true);
thread.start();
}
```

Expand Down

0 comments on commit 92c4bab

Please sign in to comment.