Re: multiproccess: What is the Dameon flag?

2009-09-16 Thread MRAB

Allen Fowler wrote:



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.


Thank you.

Two clarification questions:

1) So, without that flag the parent process could finish before the
kids, and the kids would keep running?


The parent process could finish what it's doing but not terminate (quit)
because it's waiting for non-daemon child processes to terminate.


2) If you use kid.join() in parent, the parent will always wait for
kid to finish before continuing? (And eventually quitting)


Correct.

--
http://mail.python.org/mailman/listinfo/python-list


Re: multiproccess: What is the Dameon flag?

2009-09-15 Thread MRAB

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.
--
http://mail.python.org/mailman/listinfo/python-list


Re: multiproccess: What is the Dameon flag?

2009-09-15 Thread Allen Fowler


  
  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.

Thank you.

Two clarification questions:

1) So, without that flag the parent process could finish before the kids, and 
the kids would keep running? 

2) If you use kid.join() in parent, the parent will always wait for kid to 
finish before continuing? (And eventually quitting)

Thank you,
:)



  
-- 
http://mail.python.org/mailman/listinfo/python-list