• 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
Re: Thread Communication Conceptual Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread Communication Conceptual Question


  • Subject: Re: Thread Communication Conceptual Question
  • From: Eyal Redler <email@hidden>
  • Date: Thu, 02 Aug 2007 14:36:32 +0300

Of course, you'd never write the above in a full-blown Cocoa application, right? Because if you did, you'd block event processing and your app would beachball.

Yes, I need the host application to continue normally and not hang on waiting for the sub-thread.


Using a run loop source, or - performSelectorOnMainThread:withObject:waitUntilDone: is a better bet (though the above will work fine for a Foundation tool, for instance).

Could you elaborate a bit about the run loop source? My original thought was that could just raise a flag (protected by a lock, of- course) that the main thread watches but I didn't know how to watch the flag while still processing events normally.


So to phrase it more generally, assuming that I have a global status variable which is set by any thread, how can I watch it from the main thread?

The only thing I could think of is setting a repeating timer with a small interval on the main thread which checks the variable state... I wonder if this is a viable method and if so, what would be a good interval...

Eyal
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Thread Communication Conceptual Question
      • From: Alastair Houghton <email@hidden>
References: 
 >Thread Communication Conceptual Question (From: Eyal Redler <email@hidden>)
 >Re: Thread Communication Conceptual Question (From: Filipe Varela <email@hidden>)
 >Re: Thread Communication Conceptual Question (From: Andrew Farmer <email@hidden>)
 >Re: Thread Communication Conceptual Question (From: Chris Suter <email@hidden>)
 >Re: Thread Communication Conceptual Question (From: Filipe Varela <email@hidden>)
 >Re: Thread Communication Conceptual Question (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: [OT] Re: Mixing Static and Dynamic Librararies, Multiple Definitions of Symbol, Two-Level Namespace
  • Next by Date: Re: Thread Communication Conceptual Question
  • Previous by thread: Re: Thread Communication Conceptual Question
  • Next by thread: Re: Thread Communication Conceptual Question
  • Index(es):
    • Date
    • Thread