Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: Background MAGIC (and I don't mean multifinder!!) Message-ID: <9695@goofy.Apple.COM> Date: 10 Aug 90 21:51:38 GMT References: <8JTNK0C@cs.swarthmore.edu> <82899@tut.cis.ohio-state.edu> <23598@dartvax.Dartmouth.EDU> <1990Aug10.175429.6092@ux1.cso.uiuc.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 29 In article <1990Aug10.175429.6092@ux1.cso.uiuc.edu> resnick@lees.cogsci.uiuc.edu (Pete Resnick) writes: >The method I have been using for getting something running in the >background is writing the code as a device driver that is in the >system heap and locked and the dNeedTime bit set. This seems much >safer than patching traps, and unlike VBL tasks (at least in THINK >C 4.0) you can have global variables floating around and call routines >that move memory. All the INIT does is call OpenDriver and exits. Two of the problems about writing the code as a driver (when it doesn't need to be) are that you tie up a space in the unit table (for code that does need to be a driver), and that there may not be an opening for it in the unit table (admittedly there usually is). Patching traps is not as terrible as you imagine as long as you take a little care in writing the code. And both trap patches and VBL tasks can have as global a variable as a driver can. Which are really private variables since the applications own the global data space... steve -- ____________________________________________________________________ Steve Christensen Internet: stevec@goofy.apple.com Apple Computer, Inc. AppleLink: STEVEC 20525 Mariani Ave, MS 81-CS CompuServe: 76174,1712 Cupertino, CA 95014 "You just contradicted me." "No I didn't." ____________________________________________________________________