qureshi@uhura.cs.wisc.edu (Mohammad Qureshi) (10/16/89)
I have been considering writing an INIT that would, after a set time, present a dialog to the user. This would be a sort of alarm which the user would be able to set (using a cdev interface). My question is, should I implement this alarm as a VBL task, checking each time if one of the alarm times has been reached, or should I patch WaitNextEvent/GetNextEvent and/or appropriate traps to check whether or not the alarm should go off? I know I could implement it as a driver and the wait time can be set this way, but I really don't think that that is my answer. Any assistance will be greatly appreciated.
aw0g+@andrew.cmu.edu (Aaron Wohl) (10/16/89)
If you want to put up a real dialog that you control you can't do that from a vbl task. If some text with an ok button is enough then you can use the notification manager to do that (see the tech note). If you want the real dialog there are two things you can do a)Make a device driver that loads into the system help and use it's idle routine. b)Patch a trap. Aaron
jackiw@cs.swarthmore.edu (Nick Jackiw) (10/17/89)
In article <189@uhura.cs.wisc.edu> qureshi@uhura (Mohammad Qureshi) writes: > I have been considering writing an INIT that would, after a set time, present > a dialog to the user. This would be a sort of alarm which the user would > be able to set (using a cdev interface). My question is, should I implement > this alarm as a VBL task, checking each time if one of the alarm times has > been reached, or should I patch WaitNextEvent/GetNextEvent and/or appropriate > traps to check whether or not the alarm should go off? > > Any assistance will be greatly appreciated. I'd definitely go with the trap patch, not the VBL. That way, while you may take up more or less processor cycles than a VBL (depending on the frequency of calls to WNE), you're guaranteed to be doing it at a time when the foreground application is "looking for something else to do", as opposed to doing it during the middle of somebody else's processor- intensive computations. Furthermore, you've got a *lot* more flexibility in memory access and toolbox use in an event-loop trap than you do running at interrupt level. Lastly, you can take as much time as you like if it's not in a VBL---they didn't name it "WAITnextEvent" for nothing :-)! -Nick -- _ _|\____ Nick Jackiw | Visual Geometry Project | Math Department / /_/ O> \ ------------+-------------------------+ Swarthmore College | O> | 215-328-8225| jackiw@cs.swarthmore.edu| Swarthmore PA 19081 \_Guernica_/ ------------+-------------------------+ USA