Question about Threading
Question about Threading
- Subject: Question about Threading
- From: Michael Becker <email@hidden>
- Date: Mon, 8 Aug 2005 14:39:17 +0200
Hello all,
I am trying to implement a very basic multithreading into my
application and I am encountering a probably simple problem, here it
goes:
I have a custom view that loads image thumbnails. The user can choose
from any source (folder, iPhoto library etc.). In order to not block
the User Interface I want to perform that image loading in a
background thread. Here come the questions:
- I want to display the progress of loading. Therefore, I user
performSelectorOnMainThread: to call a method which itself again
calls my views setNeedsDisplay:, it that okay?
- When the user chooses a different image source BEFORE the view has
finished loading every image, the following should happen: The
current loading thread is terminated, the view disposes of all its
current images, a new image loading thread is detached.
I have created a (class-wide) boolean variable which the thread
checks on each iteration to see whether it may continue or not.
However, I get synchronizing problems: When I set that boolean
variable to STOP the thread, how can I make sure that I wait until
the thread has finished its current iteration and then exited?
What (in general) is the best way of doing things like that?
Regards,
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