Running a thread in the nginx worker process cycle

Hi.

With mod_wsgi I’m starting to testing threading usage in the Python
application.

Do I have to take some precautions when starting a new thread?
In the nginx sources I see that some signals are blocked.

Above all, it is safe to start a new thread?

Thanks Manlio P.

On Thu, Dec 27, 2007 at 03:39:10PM +0100, Manlio P. wrote:

With mod_wsgi I’m starting to testing threading usage in the Python
application.

Do I have to take some precautions when starting a new thread?
In the nginx sources I see that some signals are blocked.

Above all, it is safe to start a new thread?

It’s not simple question. I can not say right now.

Igor S. ha scritto:

It’s not simple question. I can not say right now.

Ok, thanks.

I will try to do some better tests, however the WSGI application at:
http://hg.mperillo.ath.cx/nginx/mod_wsgi/file/tip/examples/nginx-thread-pool.py
seems to work, even with an high level of concurrency.

By the way, there is an interesting post about a multithreaded python
application embedded in PostgreSQL (with plpython):
http://mail.python.org/pipermail/python-list/2007-December/468320.html

In that case, Tome Lane response is simply:
Don’t even think about starting multiple threads inside the Postgres
backend. It’s an excellent way to break things.

Manlio P.