Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!haven!purdue!decwrl!sun!pitstop!sundc!seismo!uunet!munnari!jkjl From: jkjl@munnari.oz (John Lim) Newsgroups: comp.sys.mac.programmer Subject: Re: Re: A plea for help (double-clicking disabled in Finder...) Message-ID: <2672@munnari.oz> Date: 6 Feb 89 02:25:47 GMT References: <379@lclark.UUCP> <2580011@hpausla.HP.COM> <25305@apple.Apple.COM> Reply-To: jkjl@munnari.UUCP (John Lim) Organization: Comp Sci, Melbourne Uni, Australia Lines: 41 > Something that I don't believe is very explicitly spelled out >in Inside Mac, although it is mentioned several times is that you really >do want to restore the previous lock state. Most times your code should >look like: > > short state = HGetState(handle); > > HLock(handle); > ... > HSetState(handle, state); > >That way you get to make sure it's locked and at the same time don't destroy >anybody else's notion that it's locked. > >David W. Berry >apple!dwb@sun.com dwb@apple.com 973-5168@408.MaBell You only need to do something like this for shared resources like those from the System File or when you have IPC. Otherwise checking the Resource Bits is not really necessary. The normal HLock-HUnlock pair of traps is satisfactory for most circumstances. john lim ---------------- lineeater lineeater lineeater lineeater lineeater lineeater lineeater lineeater lineeater lineeater lineeater lineeater lineeater lineeater lineeater