That sounds like a good idea to me. Let Chuck (or I) put the hooks in, and then we'll work on making it a Plug-In. I think it might work to have a list of functions that are called when threads start and stop their processing, and from a PlugIn, you could just add your functions to that list.
BTW, ThreadedAppServer is, if not deprecated, at least not as receommended as AsyncThreadedAppServer. The Async will be the default going forward.
> Chuck Esterbrook wrote:
> > Geoff,
> > Can we make this a plug-in? I don't mind putting it in Webware, but I'd
> > like to keep WebKit fairly small and focused on simply serving servlets on
> > any platform.
> > -Chuck
> I don't know enough about plug-ins to be able to answer that. The key to
> making COM work inmultiple threads is that
> sys.coinit_flags >
> has to be executed before any COM modules are imported. And in each thread,
> you have to call pythoncom.CoInitializeEx() before using COM, and
> pythoncom.CoUninitialize() after using COM.
> If there's a way to accomplish this using a plug-in, that would be fine with
> me. But here's a simple approach that doesn't put any platform-specific stuff
> in ThreadedAppServer:
> Add stub member functions "initThread" and "delThread" that ThreadedAppServer
> calls at the beginning and end of threadloop, in the same places that I'm
> calling CoInitializeEx and CoUninitialize. Then, I can write a
> COMThreadedAppServer.py that calls sys.coinit_flags , and
> creates a derived class from ThreadedAppServer that calls CoInitializeEx in
> initThread and CoUninitialize in delThread.
> If this sounds acceptable, let me know if you want me to code it.
> - Geoff Talvola
> Parlance Corporation
WorldPilot - Get Synced - http://www.worldpilot.org
The Open Source Personal Information Manager Server
Powered by Python and Zope - http://www.zope.org