Re: NSOutlineView (or NSTableView) and threaded, live data display
Re: NSOutlineView (or NSTableView) and threaded, live data display
- Subject: Re: NSOutlineView (or NSTableView) and threaded, live data display
- From: "John C. Daub" <email@hidden>
- Date: Thu, 01 Jun 2006 10:54:57 -0500
- Thread-topic: NSOutlineView (or NSTableView) and threaded, live data display
on 6/1/06 12:26 AM, Michael Ash at email@hidden wrote:
> I have not done this personally, but I've talked to people who have
> and it seems that the best architecture is to always manipulate the
> final data store in the main thread.
>
> For your architecture, this may mean that you simply have the
> "consumer thread" be the main thread. Or you may keep the consumer
> thread as-is, and simply duplicate the final data store.
>
> In either case, instead of manipulating the store directly and
> guarding access with locks, you would wrap the changes up into an
> object and ship it to the main thread using
> -performSelectorOnMainThread:.... Once it gets there, you can modify
> your local data store and then invoke -reloadData. If you're updating
> frequently then it would probably be best to throttle your -reloadData
> calls to a few times a second.
>
> This avoids the whole locking business (always a good thing), keeps
> your refreshing more responsive while eliminating the need to poll,
> allows you to remove objects without risking tripping up your data
> source, and is generally simpler overall. You can do the whole thing
> without having to subclass the view or putting any thread-aware code
> into any data source methods.
Hrm. Certainly a different way of going about it, but it does seem simpler
because it does get rid of a lot of complexity... and any ridding of
complexity, especially when dealing with threads, is good. :-)
I'm not 100% sure I can take this approach, given some shared code that I
have to use and thus some restrictions already imposed upon me. But, as I
work on this today I'll certainly consider this approach.
Thanx for the reply.
(and if anyone else has any input, be it new ideas like this or just direct
response to my original questions, I'm all ears). :-)
--
John C. Daub }:-)>=
<mailto:email@hidden> <http://www.hsoi.com/>
"Life is good, a rock sled utopia, a self-imposed myopia.
You gotta love this pace." - Dave Wyndorf
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden