Stopping threads

Joshua Marshall grumble at lycos.com
Mon Feb 3 17:22:53 CET 2003


As far as I know, it can't be done.  The closest I've been able to
come is to interrupt the main thread using a unix signal.  I expect
this is not a good answer.

Afanasiy <abelikov72 at hotmail.com> wrote:
> I am running up to half a dozen threads as needed. When a thread is done
> working, it is available for more work. However, I cannot call start() on
> that thread again... AssertionError: thread already started

> In another language I could stop() (as well as pause/resume/waitfor/etc)
> and do what I want. However, in Python Threading I do not know what I
> should do. I want to be able to call the thread's start() multiple times,
> but of course only do so when it has finished run()'ing... (which I track)

> The most obvious thing I looked for was stop(), but there is none.

> So what should I do? Good answers will not require me to adopt
> some other thread pool paradigm, as my own is the usual for me.




More information about the Python-list mailing list