Re: NSTableDataSources and multi-threading
Re: NSTableDataSources and multi-threading
- Subject: Re: NSTableDataSources and multi-threading
- From: Nick Zitzmann <email@hidden>
- Date: Tue, 4 Nov 2003 20:43:42 -0800
On Nov 4, 2003, at 12:11 AM, Sean Gilbertson wrote:
I have a data source, whose represented data is updated by several
threads. Because of this, the result of numberOfRowsInTableView: may
not be valid by the time tableView:objectValueForTableColumn:row: is
called. I have tried several ways of making sure that this does not
occur, including subclassing NSTableView and notifying the data source
when reloadData is called, but of course that is not the appropriate
place to look for redrawing of the table view; it is an auxiliary
method. Of course, I am using locks, but they are almost worthless
unless I can actually guarantee incorrupt output.
The way I fixed this with one project was to add a lock object, use
PB's Find window to point out each place in the code that the data
source was being accessed, and then add balancing lock and unlock calls
to each place. It's pretty much the only way to do what you want to
do...
Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page:
http://seiryu.home.comcast.net/
S/MIME signature available upon request
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone." - Bjarne Stroustrup
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.