Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

Stopping all threads from other thread

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


amadeusz.jasak at gmail

Aug 19, 2006, 12:33 PM

Post #1 of 3 (558 views)
Permalink
Stopping all threads from other thread

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...

Amadeusz Jasak (Poland)

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


fakeaddress at nowhere

Aug 19, 2006, 10:10 PM

Post #2 of 3 (491 views)
Permalink
Re: Stopping all threads from other thread [In reply to]

amadeusz.jasak [at] gmail 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
--
http://mail.python.org/mailman/listinfo/python-list


amadeusz.jasak at gmail

Aug 19, 2006, 10:24 PM

Post #3 of 3 (495 views)
Permalink
Re: Stopping all threads from other thread [In reply to]

Thanks,
it's working

Bryan Olson wrote:
> amadeusz.jasak [at] gmail 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

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

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.