checking a thread has started

Deepak Sarda deepak.sarda at gmail.com
Sat Nov 6 08:58:29 EST 2004


Hello everyone.

I have run into something which I believe is a bug or a shortcoming of
the threading.Thread module.

My program spawns 15 threads. For this I've creating a new class with
threading.Thread as the base class. Then I create objects of this
class and call their start() methods in a loop.

The program works fine when run locally in a shell. The problem starts
when it is served through apache as a cgi program. I just can't get
all the threads running. The constructor is properly called for each
object but for some of them  - the run() method never gets called. I
can get around this by introducing a delay in between calls to the
start() methods of the fifteen objects (using time.sleep(2)).

I believe this bottleneck is due to Apache server - it just can't
spawn so many threads so quickly. It just spawns seven threads and
that's it.

My question is: how do I check whether a call to the start() method
was successful? If there is a mechanism by which I can get this
information - I can try restarting/recreating the thread.

I am running this on Python 2.2 and Apache 1.3.27

Regards,

Deepak



More information about the Python-list mailing list