fork, threads and proper closing
nikon at puffy.pl
Mon Jun 29 08:22:06 CEST 2009
> On 28 juin, 23:26, Tomasz Pajor <ni... at puffy.pl> wrote:
>> Configuration is as follows.
>> I have a starter process which creates 3 sub processes (forks) and each
>> of this processes creates a number of threads.
>> Threads in that processes have semaphore so on KeyboardInterrupt without
>> sending a sigterm to the subprocess i'm not able to close threads.
>> Is there any work around? Can I somehow run join for the thread on
>> keyboard interrupt?
> When creating a thread you can add a Queue parameter to communicate
> with threads:
> easy and reliable.
> give them a "poison pill" in the queue: a recognizable object placed
> on the queue that means "when you get this, stop."
can You provide any working example?
> better to not rely on keyboard for thread stopping.
i use keyboard interrupt only for debuging purposes
More information about the Python-list