> 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?

No - given the docs posted before, they are created once and shared.  When a
request completes, its thread becomes available to process the next request.
Thus, its better perf wise to only call the CoInit functions once as the
thread starts.


> (and yes, on windows the MPM winnt is used)
> 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?

CoInit functions can fail if someone else has beaten you to calling CoInit,
and requested a different threading model.  Ideally, you should call
CoInitializeEx(COINIT_MULTITHREADED), and if you happen to be using a
free-threaded COM object, your threads will not interfere with each other at
all.  Apartment threading (the default) may not perform as well.  Requesting
free-threading should not hurt if the object is not free-threaded, but you
would want to make sure :)

> 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? I guess you thinking of some
> standard python modules (as there's probably a python module for
> everything =))?

Google for something like "consumer and producer pattern"

Cheers,

Mark

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to