Stopping all threads from other thread

alfanick amadeusz.jasak at gmail.com
Sun Aug 20 01:24:37 EDT 2006


Thanks,
it's working

Bryan Olson wrote:
> amadeusz.jasak at gmail.com wrote:
> > Hello,
> > it is possible to stop all threads (application) from thread of
> > application:
> > App
> >  |-MainThread
> >  |-WebServer
> >  |-CmdListener # From this I want to stop App
> >
> > The sys.exit isn't working...
>
> You can start all threads other than CmdListener as daemon
> threads, using threading.Thread.setDaemon(). Then when
> CmdListener exits, the program will exit. Python starts with
> one, non-daemon thread, and if that's what you are using for
> MainThread, you'd have to switch which thread runs what.
>
> Python deliberately does not offer a threadicide method.
> 
> 
> -- 
> --Bryan




More information about the Python-list mailing list