[Pythonmac-SIG] PythonCGISlave conflict with SMTPlib? (MacOS 9, Pers. Web Sharing)

Jack Jansen jack@oratrix.nl
Mon, 21 Aug 2000 10:19:55 +0200


> import MacOS, Events
> old = MacOS.SchedParams(1, Events.osMask, 1, 0.25, 0.25)
> try:
> 	...smtp stuff...
> finally:
> 	apply(MacOS.SetSchedParams, old)
> 
> (I'm not 100% sure whether these are the best settings, though.)
> 
> There's at least one gotcha: I think this will only work well if the
> PythonCGISlave app is in the background. Jack: in PyMac_Yield(), maxsleep
> is set to 0 when in the Python app is in the foreground; I think this might
> explain some of the AE lockups or slowdowns people have been experiencing.
> Would it be an idea to simply set it to 1 when in the foreground? And why
> isn't there fg_yield in SchedParams?

You're right, but setting the "max yield" to anything other than zero for 
foreground operation will result in a serious slowdown. At least, it did when 
I wrote the new Yield and SchedParams and stuff (around MacOS 8). The event 
handling code inside MacOS seems to have changed drastically, so it might be 
worth a try. Could you try this mod and compare Pystone results?

A better option is to make a distinction based on why we are getting to 
PyMac_Yield. If we're there because we are waiting for I/O to complete (or for 
an AppleEvent to come in) we could pass a nonzero maxsleep, but if the call 
comes from the once-in-a-while check from the main python loop we should pass 
0. I tried to do something like this, but apparently it doesn't work.

If someone feels the urge to look into this and suggest fixes: please do so!
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm