[comp.sys.mac] But if I can't use SystemTask...???

blakem@eleazar.dartmouth.edu (Blake Meike) (04/29/89)

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?

Any enlightenment would be greatly appreciated.  Mail words of wisdom to:

B.Meike@dartmouth.edu

tecot@Apple.COM (Ed Tecot) (05/15/89)

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