Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HUnlock always after HLock?



> : Dan Crevier <email@hidden>

>> But don't bother using HLock/HUnlock or HSetState on Mac OS X.
>> (Unless
>> you know that someone is going to explicitly look at those bits.) The
>> handle will not move or be purged on OS X.
>
> Is this behavior guaranteed for the future? Is it documented anywhere?

I can't seem to find any documentation that explicitly states this,
however, I personally guarantee that if you're using handles for your
own purposes, it will not move and will not require HLock. I'll see
if we can't get that written up in a tech note or something.

It is possible that there is some overlooked quicktime API that
requires you pass it an HLock'd handle, or ptr to an HLock'd handle. I
don't know of one off hand, however.

If you do go through and remove all your HLocks, HUnlocks and
HSetStates, be aware of one important gotcha: HLock sets MemErr as a
side effect. If you remove an HLock or HSetState, make sure that
you're not checking MemErr as a side effect.

Later, in this thread:

> Jonathan Brecher>>
> Is this a recent-ish (Panther) change? I had entered rdar://2852119
> because some system-level function was locking a PaletteHandle out
> from underneath me, which caused subsequent resize attempts to fail.
> That bug was marked as fixed in Panther, but of course I didn't get
> any specifics about the nature of the change.
>
> Is the locked state of a handle now *totally* ignored on Mac OS X, or
> were you only referring to the specific situation of disposing a
> locked handle?

The state, and the API, are both still completely implemented; however
on OS X the SetHandleSize on a locked block behavior is a compatability
issue more than anything else. If nobody ever called HLock (and nobody
ever checked) the world would be a fine place.

And to re-iterate: DisposeHandle on a locked handle is fine in Carbon
on OS X, and OS 9. And OS 6, if you can remember that far back ;-)

--smz
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: HUnlock always after HLock? (From: Dan Crevier <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.