Re: Thread Communication Conceptual Question
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