On Oct 26, 2010, at 1:07 PM, Bill Bumgarner wrote:
> On Oct 26, 2010, at 12:42 PM, Sean McBride wrote:
>> And presumably objc_unregisterThreadWithCollector() at the end of your
>> thread's function... yes?
> 
> Yes;   it'll happen automatically on thread death, effectively.
> 
> Registering/unregistering a thread on the fly isn't really something that is 
> supported well.   I.e. once a thread goes GC, it really should stay that way.

To clarify: do not call objc_unregisterThreadWithCollector(). The thread will 
be unregistered automatically when it completes. 

You can use register+unregister to move a thread in and out of GC, but that has 
subtle pitfalls and is not recommended. (For example, if you explicitly call 
unregister but some other framework code set up a pthread thread-specific 
destructor that expects to run on a GC thread, you could crash.)


>> Andy, also beware that those two functions are not properly marked as
>> weak, and so if your deployment target is < 10.6 and even if you test
>> them against NULL, you will crash. :(  <rdar://8508911>
> 
> Boo.  Thanks for the bug.

As a workaround, you can redeclare the functions in your own code with 
appropriate availability macros.


-- 
Greg Parker     [email protected]     Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to