Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!tecot From: tecot@Apple.COM (Ed Tecot) Newsgroups: comp.sys.mac Subject: Re: But if I can't use SystemTask...??? Keywords: WaitNextEvent SystemTask DA MultiFinder EventAvail Message-ID: <30694@apple.Apple.COM> Date: 15 May 89 03:16:31 GMT References: <13265@dartvax.Dartmouth.EDU> Organization: Apple Computer Inc, Cupertino, CA Lines: 25 In article <13265@dartvax.Dartmouth.EDU> B.Meike@dartmouth.edu writes: >What is the correct way to make sure that DA's get their slices of the >pie when using WaitNextEvent? > >My application, at one point, sits in a fairly tight loop waiting >for a mouse down. It calls EventAvail. It used, also, to call >SystemTask, per the documentation, to be sure that DA's got a chance >at the processor. New docs say that if you call WaitNextEvent, you >shouldn't call SystemTask. Ever? Should I still be calling it in the >loop with EventAvail? Or should I call something else (what)? Or does >EventAvail do it automatically now? What the documentation means, is that, if you are in a loop calling WaitNextEvent, you shouldn't call SystemTask in that same loop. MultiFinder will do that for you. However, since you are in a loop with EventAvail, you do need to call SystemTask. However, that begs the question: Do you need to be in a loop calling EventAvail? It seems redundant to me that you have 2 event loops. Keep in mind that MultiFinder can swap you out at any time, sending you a suspend event (assuming you accept them). If you ignore it, you may be heading for a heap o' trouble. I strongly recommend that you have only one event loop. It will make your work that much easier. _emt