multiproccess: What is the Dameon flag?

MRAB python at mrabarnett.plus.com
Tue Sep 15 20:14:35 EDT 2009


Allen Fowler wrote:
> Hello,
> 
> What is the Daemon flag and when/why would I want to use it?
> 
 From the documentation: "When a process exits, it attempts to terminate
all of its daemonic child processes.".

Sometimes you want the main process to wait for its worker processes to
terminate before terminating itself so that you can be sure that
everything (including resources they might use) has been tidied up.
Other times there's nothing to tidy up so you just want the worker
processes to terminate when the main process terminates. In the second
case the worker process are known as daemon processes.



More information about the Python-list mailing list