[python-win32] Apache & mod_python & win32com

Robert Brewer fumanchu at aminus.org
Thu Apr 24 21:31:14 CEST 2008


Dominique.Holzwarth at ch.delarue.com wrote:
> Thank you Rober & Alex for the answers :-)
> But I must admit that I'm still bit uncertain about that whole issue.
> As I understood apache it is creating a thread for every request
> anyway, or not? (and yes, on windows the MPM winnt is used)

As I understand it, Apache creates a pool of threads and re-uses them.
From
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#threadsperchild:

    "This directive sets the number of threads created by each child
process.
     The child creates these threads at startup and never creates more."

> so wouldn't it be enough to just call CoInitialized() at the start of
> my (mod_python) python-handler and CoUnitialize() and the end of my
> handler? the try... finally you have added only for the case my script
> would "crash", right? so that the CoUnitialize() is called in that
case
> as well?

Yes, exactly.

> The idea about the single thread and queue I don't really get to be
> honest... what sort of object would be passed in the queue? And how
> would I create that queue and the thread?

Don't worry about it for now if the try/finally approach works. Ask
again if you need to.

> I guess you thinking of some
> standard python modules (as there's probably a python module for
> everything =))?

:) Yup, there is a Queue module:
http://docs.python.org/lib/module-Queue.html.


Robert Brewer
fumanchu at aminus.org



More information about the python-win32 mailing list