Path: utzoo!attcan!uunet!cs.utexas.edu!news-server.csri.toronto.edu!clyde.concordia.ca!ccu.umanitoba.ca!guelzow From: guelzow@ccu.umanitoba.ca (Andreas J. Guelzow) Newsgroups: comp.sys.mac.programmer Subject: Re: HLock interdiction?? Keywords: MacTutor, Memory Manager, DogCow Message-ID: <1990Sep25.153518.18921@ccu.umanitoba.ca> Date: 25 Sep 90 15:35:18 GMT References: <1990Sep21.043054.24649@cunixf.cc.columbia.edu> Organization: University of Manitoba, Winnipeg, Canada Lines: 17 Sender:Andreas Guelzow In article <1990Sep21.043054.24649@cunixf.cc.columbia.edu> jtt@cunixd.cc.columbia.edu (James T. Tanis) writes: >while reading the September issue of MacTutor, in the Mousehole echo, >I saw a disturbing exchange... > >the gist was, that HLock would _Unlock_ an object if it was locked to >begin with. Is this the case? Should I call HGetState first, to determine >whether a handle is locked, and if so... with what mask??? > >For those interested, the exchange is on pg. 93 of the September issue. > >thanks! The exchange in MacTutor has been misunderstood! The problem (?) is that HUnlock will unlock the handle, i.e. calling HLock and later HUnlock leaves the handle unlocked even if somewhere else it had been locked previously (e.g. in a calling routine). This is a nice way to introduce bugs into a programme :-) . Andreas Guelzow