File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
src/com/codecafe/concurrency/thread/daemonthreads Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Simple and easy to understand code examples for most of the Concurrent APIs prov
14
14
- [ Thread States] ( ./notes/thread-states.md ) - [[ code] ( ./src/com/codecafe/concurrency/thread/basics/designathread/ThreadStates.java )]
15
15
- [ Thread Termination] ( ./src/com/codecafe/concurrency/thread/basics/Main.java )
16
16
- [ Thread Signalling] ( ./src/com/codecafe/concurrency/threadsignalling )
17
- - [ Daemon Thread ] ( ./notes/daemon-thread .md ) - [[ code] ( ./src/com/codecafe/concurrency/thread/daemonthread )]
17
+ - [ Daemon Threads ] ( ./notes/daemon-threads .md ) - [[ code] ( ./src/com/codecafe/concurrency/thread/daemonthreads )]
18
18
19
19
#### Thread synchronization and locks
20
20
- [ The ` synchronized ` keyword] ( ./src/com/codecafe/concurrency/_synchronized )
Original file line number Diff line number Diff line change 1
- ## Daemon Thread
1
+ ## Daemon Threads
2
2
3
- > A ** Daemon thread** is a low priority thread that runs in background to perform housekeeping tasks such as garbage collection.
3
+ > ** Daemon threads** are low priority threads that run in background to perform housekeeping tasks such as garbage collection.
4
+ > They are background threads that do not prevent the application from exiting if the ` main ` thread terminates.
4
5
5
6
#### Properties:
6
7
Original file line number Diff line number Diff line change 1
- package com .codecafe .concurrency .thread .daemonthread ;
1
+ package com .codecafe .concurrency .thread .daemonthreads ;
2
2
3
- public class DaemonThread {
3
+ public class Main {
4
4
5
5
public static void main (String [] args ) {
6
6
// Daemon thread
7
7
Thread th = new Thread (() -> {
8
- for (int i = 1 ; ; i ++)
8
+ for (int i = 1 ; i <= 10000 ; i ++)
9
9
System .out .print (" D-" + i );
10
10
});
11
11
You can’t perform that action at this time.
0 commit comments