NSMapTable thread safety (with with ARC and weak objects)
NSMapTable thread safety (with with ARC and weak objects)
- Subject: NSMapTable thread safety (with with ARC and weak objects)
- From: James Montgomerie <email@hidden>
- Date: Fri, 16 Nov 2012 17:53:47 +0000
How thread safe is NSMapTable?
I know that's a pretty nebulous question, so more concretely:
Let's assume I'm using ARC. If I create an NSMapTable with "[NSMapTable strongToWeakObjectsMapTable]", is it safe to put objects into it that might be referenced from, and perhaps deallocated on, a background thread? Specifically, might I get a half-deallocated or retain-count-zero object back from -objectForKey: if a 'right' race condition happens?
Does the answer to this change if I guarantee that the NSMapTable itself (but not the objects it contains) will be used only on the a single thread?
Jamie.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden