Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: Question about resource handle. Message-ID: <54405@apple.Apple.COM> Date: 27 Jun 91 21:49:03 GMT References: <1991Jun27.174311.18097@midway.uchicago.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 28 chh9@quads.uchicago.edu (Conrad Halton Halling) writes: >I have stored tables of 64 doubles as different IDs of resource type 'CDNT'. >My program will load one table from a specific ID (chosen by the user) and >use the doubles in the table in a long series of calculations. For >simplicity, I want to lock the handle to the resource so I can use a >pointer in my calculations. > >I realize the size of this resource (640 bytes) is small, but I would like >to know which is the best strategy for locking the handle: > >1) I could set the "locked" attribute in the resource file, so that the > handle is locked immediately when the resource is loaded into the > application heap. > >2) I could get the resource without the "locked" attribute set, then > MoveHHi( myHandle ) and HLock( myHandle ). It's better to keep the resource unlocked and lock it as needed by calling HLock. You should be able to keep it unlocked much of the time, locking it only when you are directly referencing the contents of the block and memory might be moved... steve -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Steve Christensen Never hit a man with glasses. stevec@apple.com Hit him with a baseball bat.