Re: NSOutlineView threading problem
Re: NSOutlineView threading problem
- Subject: Re: NSOutlineView threading problem
- From: "Michael Ash" <email@hidden>
- Date: Sun, 15 Jun 2008 22:25:47 -0700
On Sun, Jun 15, 2008 at 8:05 PM, David <email@hidden> wrote:
> As it stands its a nightmare if something as trivial as an Array
> isn't even thread safe.
I'm not sure how having thread safe arrays would help. If you're
mutating a collection in one thread while you're accessing it from
another then you will have trouble no matter what happens.
Take this example. The outline view asks you how many items there are.
You say 3. Now your background thread deletes one. Now your outline
view asks you for item #3. Your code explodes violently.
Handling this properly really requires a whole new API. You need a
concept of transactions, or views on the data, or explicit locking of
the data structures. Simply making NSMutableArray thread safe gives
you essentially nothing, it just moves the problem around.
Mike
_______________________________________________
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