• 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
Question about Threading
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Question about Threading
      • From: Dominic Yu <email@hidden>
    • Re: Question about Threading
      • From: Cameron Hayne <email@hidden>
  • Prev by Date: Re: NSOutlineView selectable only children
  • Next by Date: Re: objc and RDBMS
  • Previous by thread: RE: Subclassing NSTextView under Tiger
  • Next by thread: Re: Question about Threading
  • Index(es):
    • Date
    • Thread