NSTableView and threads...
NSTableView and threads...
- Subject: NSTableView and threads...
- From: Michael Burbidge <email@hidden>
- Date: Thu, 17 Feb 2005 20:54:50 -0800
I have an NSTableView which contains a list of files. The files are added to the list by dragging in from the finder. The files are processed and removed from the list by a number of threads, which is configurable. The table view has a data source, and in the data source I override
numberOfRowsInTableView: and
objectValueForTableColumn:row:. When files are added to the data structure that the table view is a view of it is surrounded by a mutex (lock). The problem I have is that I also need a mutex around the data structure when the NSTableView accesses it via the two methods
numberOfRowsInTableView: and
objectValueForTableColumn:row:. but I'm not in control at that point. What happens is that in between the time the table view calls the numberOfRowsInTableView: method and the objectValueForTableColumn:row: method, files are deleted from the data structure the table is viewing, by the threads that are processing the files in the data structure. The result is an array index out of bounds.
Is there anyway to use the NSTableView in a thread safe manner, where threads may add or remove elements from the data structure the table is viewing?
Thanks,
Michael-
_______________________________________________
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