[Pythonmac-SIG] Cooperative threading on Mac (was: playing well with others (newbie question))

Skip Montanaro skip@mojam.com (Skip Montanaro)
Thu, 30 Dec 1999 09:57:58 -0600 (CST)


(I've redirected this from the main list to the PythonMac-SIG.)

    Michael> I'm stuck with the following problem with python 1.5.2c1 on
    Michael> MacOS 8.6: 

    Michael> while 1:
    Michael>     pass

    Michael> grinds my system to a halt. In other languages there are
    Michael> commands that give away cycles to the rest of the system and
    Michael> thus "playing well with others." Is there some similar command
    Michael> in python? Something to replace that pass with that allows me
    Michael> to do other things with my system?

The code that implements pass in ceval.c could easily be modified to
periodically call whatever Mac toolbox function is used to release the
processor.  Unfortunately, the Mac-specific source code seems not to be
under CVS control, so while I can see some tantalizing hints of what needs
doing in the source on my Linux machine, I can't suggest anything specific.
I'm sure Jack or someone else will know precisely what needs doing.

Skip Montanaro | http://www.mojam.com/
skip@mojam.com | http://www.musi-cal.com/
847-971-7098   | Python: Programming the way Guido indented...