FROM : Joe Chan
DATE : Sun Dec 19 21:58:51 2004
I have a general question about threading and NSArrayController. For
the model objects that I need to display in a NSTableView, one of the
columns is for thumbnails (and the model object has a thumbnail key
that returns an NSImage). Since loading a bunch of thumbnails can take
a while, I'm planning to have the model object returns a placeholder
NSImage, and then go off and fetch the thumbnail in a the thread. My
question is how to do so safely. There is no indication that
NSArrayController is thread safe, and having another thread calling
[obj setThumbnail] after the thumbnail is loaded (which trigger all the
KVO stuff in that thread) is probably a bad idea. One idea I have is to
set up a work queue and and NSTimer in the main thread to retrieve the
thumbnail as they are loaded. Any better ideas?
--
Joe Chan
Sun Microsystems, Inc.
Burlington, MA
Tel: (781) 442-0809
DATE : Sun Dec 19 21:58:51 2004
I have a general question about threading and NSArrayController. For
the model objects that I need to display in a NSTableView, one of the
columns is for thumbnails (and the model object has a thumbnail key
that returns an NSImage). Since loading a bunch of thumbnails can take
a while, I'm planning to have the model object returns a placeholder
NSImage, and then go off and fetch the thumbnail in a the thread. My
question is how to do so safely. There is no indication that
NSArrayController is thread safe, and having another thread calling
[obj setThumbnail] after the thumbnail is loaded (which trigger all the
KVO stuff in that thread) is probably a bad idea. One idea I have is to
set up a work queue and and NSTimer in the main thread to retrieve the
thumbnail as they are loaded. Any better ideas?
--
Joe Chan
Sun Microsystems, Inc.
Burlington, MA
Tel: (781) 442-0809
| Related mails | Author | Date |
|---|---|---|
| Joe Chan | Dec 19, 21:58 | |
| John C. Randolph | Dec 21, 00:26 | |
| Joe Chan | Dec 22, 15:29 | |
| John C. Randolph | Dec 22, 22:08 | |
| Joe Chan | Dec 22, 22:27 | |
| Scott Stevenson | Dec 22, 22:40 | |
| John C. Randolph | Dec 23, 00:16 | |
| mmalcolm crawford | Dec 23, 00:26 | |
| mmalcolm crawford | Dec 23, 00:41 |






Cocoa mail archive

