• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTableView and threads...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSTableView and threads...
      • From: Pontus Ilbring <email@hidden>
  • Prev by Date: cell respond to key events
  • Next by Date: Re: cell respond to key events
  • Previous by thread: Re: cell respond to key events
  • Next by thread: Re: NSTableView and threads...
  • Index(es):
    • Date
    • Thread