Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conflict between Application and StartOnMainThread



On Sunday 08 April 2007 01:32:47 Michael Hall wrote:
> My guess there might be that the OS X events are set up to be
> delivered on the main thread. There is no reason, assuming you can
They are, I think.

> receive them at all, that you couldn't immediately pass their
> processing off to another thread once you have them. You aren't
> required to stay on the main thread.
The problem is that you don't get them at all. To have the SWT part work, you 
need to have your app start on the main thread. If you do this, then the OSX 
events get completely lost.

> If they are throwing Carbon into the mix then they also get
> additional points for a even greater degree of difficulty.
Well, SWT uses carbon for its UI drawing and events, apparently due to the 
fact that carbon and SWT have a very similar event model, so it was the easy 
way out at the time SWT was written. Apple Java expects you to be using its 
AWT-based stuff for events, which gives us the whole thread situation, as 
they each need to have the primary thread. This isn't the same as spinning 
off another JVM thread I think. My guess is that when you launch a JVM 
normally, it starts two threads at the C level: one running an AWT-to-Cocoa 
interface, the other running the actual JVM. When you want to use carbon 
(like SWT does), you can't do that, you need the JVM (and thus the SWT 
libraries) to be the primary thread so that events go straight to it, and the 
whole AWT interface thing never happens, and so events never get passed 
through. So what needs to be done is a JNI layer to add the openDoc listeners 
through carbon, which seems to be how Azureus does it (from what I can tell).

I'm learning much more than I ever wanted to know about this :)

(And it turned out I had a typo in my procmail rules, so messages weren't 
ending up in the right place, now I see the list properly:)

-- 
Robin <email@hidden> JabberID: <email@hidden>

Hostes alienigeni me abduxerunt. Qui annus est?

PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8  7175 14D3 6485 A99C EB6D

Attachment: pgpn1JeDjEiW0.pgp
Description: PGP signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Conflict between Application and StartOnMainThread (From: Robin Sheat <email@hidden>)
 >Re: Conflict between Application and StartOnMainThread (From: Michael Hall <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.