day40 basis of a python daemon thread

Whether it is a process or thread, follow: Guardian xx xx will wait after the main run is completed destroyed. It is emphasized that: not finished running terminates

# 1. For the main process, the operation is completed refers to the main process code has finished running 
# 2 on the main thread, the run is completed refers to the main thread within a process where all non-daemon threads running all completed before the main thread count finished running

 


# 1 in the main process after the end of its code has finished running the count (daemon was recovered at this point),
then the main process will always wait for the child process after recycling non-guardian of the child processes run is completed (or will cause zombie process), will end, # 2 is considered the main thread has finished running (daemon thread is recovered at this time) after other non-daemon thread has finished running.
Since the end of the end of the process means that the main thread, the whole process will be recycled resources, and the process must be guaranteed to end after non-daemon threads have finished running.

 

Guess you like

Origin www.cnblogs.com/wang-tan/p/11449145.html
Recommended