Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!bionet!agate!shelby!neon!pescadero.Stanford.EDU!philip From: philip@pescadero.Stanford.EDU (Philip Machanick) Newsgroups: comp.sys.mac.programmer Subject: Re: HLock interdiction?? Keywords: MacTutor, Memory Manager, DogCow Message-ID: <1990Sep21.212502.14028@Neon.Stanford.EDU> Date: 21 Sep 90 21:25:02 GMT References: <16451@unix.SRI.COM> <1990Sep21.043054.24649@cunixf.cc.columbia.edu> Sender: news@Neon.Stanford.EDU (USENET News System) Reply-To: philip@pescadero.stanford.edu Organization: Computer Science Department, Stanford University Lines: 16 In article <16451@unix.SRI.COM>, mxmora@unix.SRI.COM (Matt Mora) writes: > You need to use Hgetstate/Hsetstate to keep the handle as it were. If you need > to lock a handle by all means do it. Just save the state of the handle before > hand and reset it back after you are done with it. Remeber that handles can > have more states than just being locked. Also you probably don't need to do > this with all handles, just the ones that you share with the ROM. I actually prefer to use the Hgetstate/Hsetstate methodology generally. It's easy to forget that a routine could be called from a place in your program where a handle has already been locked. The only time I call hUnlock is as part of initialization. After that, Hgetstate/Hsetstate will always get it back to a safe condition after I've had to lock it. Philip Machanick philip@pescadero.stanford.edu