Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: ROM Unlocks handles (was Re: How to Argue Technical Points) Message-ID: <32977@ucbvax.BERKELEY.EDU> Date: 4 Dec 89 02:10:25 GMT References: <2744@dogie.macc.wisc.edu> <3838@atr-la.atr.co.jp> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 20 In article <3838@atr-la.atr.co.jp> alain@atr-la.atr.co.jp (Alain de Cheveigne) writes: _>If you use HGetState and HSetState instead, the routine leaves all handles _>just the way they were before the routine was called. The caller doesn't _>have to know how the callee does his stuff, which is the way it should be. _>But it seems that some ROM routines don't know it, and unlock handles _>behind one's back. A list of those would be nice. Alain, you have to understand "The Way od the Macintosh." The ROM expects you to only lock down what you absolutely have to, and that for as short a time as possible. To do otherwise is to risk running out of usable memory because of fragmentation. if you use a style like: HLock(handle); OneSystemCall(); HUnlock(handle); or even better: temp = (**hand).field; SystemCall(&temp); (**hand).field = temp; you'll never have to worry about the ROM unlocking things.