Skip navigation.
 
mlRe: Threading - How its done?
FROM : Michael Vannorsdel
DATE : Tue May 06 06:28:45 2008

It's usually unsafe to interact with UI objects from other threads. 
For instance with your image well, it may be in the middle of laying 
out and drawing its image in the main thread when a secondary thread 
suddenly changes the image in the middle of drawing.  This can cause 
all kinds of random problems (and sometimes appear to work fine) 
depending at what point the image was swapped.

Try changing your UI updating in your thread to calls like:

[imageWellOutlet performSelectorOnMainThread:@selector(setImage:) 
withObject:pdfImage waitUntilDone:NO];

This will make sure the update is carried out on the main drawing 
thread so UI updates are consistent.

Also I'm not sure what the purpose of the lock is in the first method, 
it's not really doing anything.


On May 5, 2008, at 8:17 PM, Karl von Moller wrote:

> I have been working on a simple application that lists all available 
> PDF's in the Users Documents Folder. I want to fill a Table view 
> with only PDF's that exist at that location. When the User selects 
> one of the PDF files (by highlighting it in the Table View) it is 
> automatically loaded into a PDF View. To make the user interface 
> appear more responsive and to let the User know what's going on when 
> a large PDF file is loaded, I thought that using Threads would be my 
> best answer. I have no experience using threads and like most people 
> out in the wild, have no clear starting place to begin learning. The 
> easy answer perhaps is to commit to building for 10.5 and use 
> NSOperation instead, but I need to be able to build for 10.4 as well!

Related mailsAuthorDate
mlRE: Threading - How its done? Karl von Moller May 6, 04:17
mlRe: Threading - How its done? John Calhoun May 6, 04:35
mlRe: Threading - How its done? Michael Vannorsdel May 6, 06:28
mlRe: Threading - How its done? Karl von Moller May 6, 06:46
mlRe: Threading - How its done? Michael Vannorsdel May 6, 07:12
mlRe: Threading - How its done? Karl von Moller May 6, 08:07
mlRe: Threading - How its done? Michael Vannorsdel May 6, 12:19
mlRe: Threading - How its done? Karl von Moller May 6, 13:04
mlRe: Threading - How its done? Michael Vannorsdel May 6, 13:10
mlRe: Threading - How its done? Karl von Moller May 6, 13:19
mlRe: Threading - How its done? Michael Vannorsdel May 6, 14:00
mlRe: Threading - How its done? Karl von Moller May 6, 15:25
mlRe: Threading - How its done? Michael Vannorsdel May 6, 16:52
mlRe: Threading - How its done? Michael Ash May 6, 18:34
mlRe: Threading - How its done? Chris Hanson May 8, 07:26
mlRe: Threading - How its done? Michael Vannorsdel May 8, 08:20
mlRe: Threading - How its done? Chris Hanson May 8, 08:45
mlRe: Threading - How its done? Michael Vannorsdel May 8, 09:16
mlRe: Threading - How its done? Scott Ribe May 8, 17:33
mlRe: Threading - How its done? Michael Vannorsdel May 9, 04:49
mlRe: Threading - How its done? Timothy Reaves May 9, 17:49