[comp.sys.mac.programmer] Allowing tasking

hpoppe@ncar.ucar.edu (Herb Poppe) (01/10/91)

In article <1991Jan9.150954.28230@santra.uucp> jmunkki@hila.hut.fi (Juri 
Munkki) writes:
> Let's put a stop to programs that fail to allow background tasking
> less than 10 times per second. The only reason why an application
> will not allow background tasks should be when the user is selecting
> from a menu (a menu manager menu).

Does TrackControl give up time to background tasks?

Similarly, how might one "unroll" all the operations of TrackControl into 
one's event loop so that one can handle other "events" while the user is 
holding down the button over a control. In my application, I need to be 
able to handle "commands" arriving via the serial port while the mouse 
user is holding down the mouse button for as long as a minute.

Herb Poppe             hpoppe@ncar.ucar.edu
NCAR                      (303) 497-1296
1850 Table Mesa Dr.
Boulder, CO  80307-3000

jmunkki@hila.hut.fi (Juri Munkki) (01/10/91)

In article <9843@ncar.ucar.edu> hpoppe@ncar.ucar.edu (Herb Poppe) writes:
>Does TrackControl give up time to background tasks?

Oops. Forgot about that one. I guess one could use action procs, but
usually users only click on controls (except scroll bars, where you
certainly have the chance of installing your own actions). The dialog
manager is supposed to be out anyway, although I still use it quite a lot.

>Similarly, how might one "unroll" all the operations of TrackControl into 
>one's event loop so that one can handle other "events" while the user is 
>holding down the button over a control. In my application, I need to be 
>able to handle "commands" arriving via the serial port while the mouse 
>user is holding down the mouse button for as long as a minute.

In your case, you could use completion routines for the serial port
drivers, or you could use action procs with calls to GetNextEvent with
a mask that allows only your own events.

BTW: I think that if you call GetNextEvent with a 0 event mask, it will
just allow background tasks to run and return. This might be a nice thing
to insert into long calculations. SystemTask probably should do the same
thing, but I seem to remember that it doesn't.

I'm not in the mood to verify all this by programming, so take all this
advice with some doubt and find out yourself what works and what doesn't.

   ____________________________________________________________________________
  / Juri Munkki	    /  Helsinki University of Technology   /  Wind  / Project /
 / jmunkki@hut.fi  /  Computing Center Macintosh Support  /  Surf  /  STORM  /
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~