checking a thread has started

Deepak Sarda deepak.sarda at gmail.com
Sat Nov 6 21:21:15 EST 2004


> Deepak Sarda wrote:
> > 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.
>
> Something else to watch out for which bites occassionally is that
> there is an import lock, and only one thread at a time can hold it.
> If a thread in Apache is importing your code, then any of your threads
> that try to do an import will just block.  Your main thread will never
> finish and the Apache framework will never finish importing you,
> so the lock is never released.
>

I am sorry but I didn't understand anything you just said :-)  I'll
just explain my code organization..

main.py: at the top - import os, sys, cgi; from core.py import *;
core.py: at the top - import os, sys, threading, time, ...
There are no other import statements anywhere else.

the worker class is defined in core.py and the function which creates
the new threads is is also in core.py.

So with this arrangement, would I be running into import lock
problems?  Why wouldn't this problem arise when run directly and not
through apache?

Deepak

--

Online: http://www.antrix.net/journal/



More information about the Python-list mailing list