Re: Threading and Event Queue Question
Re: Threading and Event Queue Question
- Subject: Re: Threading and Event Queue Question
- From: Nick Zitzmann <email@hidden>
- Date: Tue, 3 Aug 2010 14:59:16 -0600
On Aug 3, 2010, at 2:40 PM, Phil Hystad wrote:
> I am not an experienced programmer in Cocoa -- I have only dabbled. But, I have a question with regard to how event queue (terminology may not be correct) is done differently then a windows platform.
I think you meant "run loop" here.
> As an example, I noticed that each separate Tab of a Chrome browser instance is itself a separate process. Yet, each separate tab of Safari seems to be folded into the single Safari process. I have also noted that tabs in Safari are totally independent of each other such that I can be playing music from Pandora on one tab and watching a Netflix movie in another tab of the same Safari instance.
And they're all using the same run loop, with the following exceptions:
1. CoreAudio will take audio queues from any thread, but only plays them in a background thread.
2. If Safari is running as a 64-bit app, then it runs 32-bit NSAPI plugins in a background task. That's how it continues to support 32-bit plugins such as Flash and Silverlight within a 64-bit task.
> From my knowledge of the MS Windows platform (WPF for example), this cannot be done. That is, a process has a single event queue from which events are dispatched (control events like mouse, timer, and so on). Yet, on Apple Cocoa it seems that you can have multiple event queues within a single process.
Yes and no. There can be multiple run loops, but there can be only one run loop per thread. Although background threads can have run loops, IIRC they can't listen for GUI events, so they can only really used for timers, etc. But in practice, run loops in threads other than the main thread are quite rare.
> Is this true or am I barking up a wrong tree?
Why does this matter? What are you trying to accomplish?
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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