Re: IOObjectRelease: passing null? threadsafe?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Organization: Rogue Research On 10/20/08 8:17 PM, Terry Lambert said:
1) How does IOObjectRelease() react to being given null? Does it do nothing like free() or crash like CFRelease()? Yes, I could try, but I'm looking for an API guarantee one way or the other.
2) Is IOObjectRelease() threadsafe? Specifically, if I create some object on the main thread, is it safe to IOObjectRelease() it from an Objective-C garbage collector finalize method (which runs on its own thread)?
If you pass it a NULL, that is the same as MACH_PORT_NULL, which makes MACH_PORT_VALID() false, which makes mach_port_deallocate() simply return KERN_SUCCESS, which causes the function to return that.
However, it would be better if you didn't depend on there being a safety net there, and only pass in valid object references for which you've previously done a retain.
Terry, Thanks for this info. Any idea about calling IOObjectRelease() from finalize? Cheers, -- ____________________________________________________________ Sean McBride, B. Eng sean@rogue-research.com Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Sean McBride