Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!oliveb!apple!darin From: darin@Apple.COM (Darin Adler) Newsgroups: comp.sys.mac.programmer Subject: Re: Executing non-interrupt-level code after an interrupt Message-ID: <1472@internal.Apple.COM> Date: 20 Apr 89 08:25:00 GMT References: <1631@husc6.harvard.edu> Organization: Apple Lines: 29 In article <1631@husc6.harvard.edu> maymudes@husc4.UUCP (David M. Maymudes) writes: > I know that this is a "standard question", but: > > If a routine is called at interrupt time, what is the best way for it to get > control back _not_ at interrupt time. The only methods I recall hearing about > are patching _GetNextEvent (and possibly _WaitNextEvent, but probably there > is one patch which will cover all cases) and using jGNEfilter, which is a > low-memory global, and thus bad. (Also, I don't know where it is documented.) > > So is there a better way to do this? Failing that, what is the "accepted" > method? Thanks in advance for any information. Depending on why you want to do this, there are two good ways. If your reason for wanting to get control is that you don't want to keep interrupts disabled for an unreasonably long time, you can use the Deferred Task Manager. This guarantees that your routine will be called with all interrupts enabled, but you still wont be able to use the Memory Manager, or most of the higher level toolbox routines. If you want to be able to use the toolbox, you can use the Notification Manager. The response routine for a notification is run at a "good" non- interrupt time, and as long as you set the other fields to 0 and nil, no notification (icon, sound, or dialog) will occur. Your "response routine" can do whatever is necessary. -- Darin Adler, System Software Scapegoat, Apple Computer Internet: darin@Apple.com UUCP: {nsc,sun}!apple!darin