Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!ads.com!potomac.ads.com!jtn From: jtn@potomac.ads.com (John T. Nelson) Newsgroups: comp.sys.mac.programmer Subject: Questions about multitasking on the mac Message-ID: <1991May11.191114.27564@potomac.ads.com> Date: 11 May 91 19:11:14 GMT Organization: Advanced Decision Systems, Arlington, VA Lines: 48 No I don't want to start yet ANOTHER flamewar on what type of multitasking is the One And True Multitasking. Rather I have a legitimate question concerning how one passes control onto other apps running cooperatively on the Mac. Let's say I have a large and complex compiler (which I do) and let's say that it consists of lots of hairy recursive-decent style code. It's difficult to modularize this particular code so I can't call lots of modules from the event loop. Basically we go into the compiler and come back out when done. This means that I don't get to call WaitNeXTEvent and thus the foreground process has total control. No backgrounding possible because we don't get to the event loop until complete. Now, as near as I can tell the only way to provide backgrounding of this sort would be to do something like the following in EACH AND EVERY MODULE that I have in the compiler.... a_module(argument1, argument2) { blah(); foo(); while( flagSet ) { bar(); baz(); } DO_WAIT_NEXT_EVENT(); return; bar() { . . . DO_WAIT_NEXT_EVENT(); return; } and so on and so on. In the function DO_WAIT_NEXT_EVENT I have basically the same calls that I have in the top level event loop. We call WaitNeXTEvent and process various events. I suppose this can be done but its GROSS infusing this event code in every module to get timely event updates. I can't figure out a better way unfortunately. Anyone have a different philosophy on how this could be accomplished?