Stopping threads

Anton Muhin antonmuhin at sendmail.ru
Mon Feb 3 11:32:44 EST 2003


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

Feed your threads with Queue'd data.

Anton.





More information about the Python-list mailing list