Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Does SWT cocoa need -XstartOnFirstThread ?

Thanks Scott, Phil

I can confirm that we don't use any AWT/Swing at all.  We have a pure SWT application which is designed to have all GUI messages handled by a specific thread which we call our UIThread.  This is not thread-0 however.  Originally our application was developed on Windows/Linux and we ran it on Mac a little later so we had to use the -XstartOnFirstThread to work around the difference between our design and the Mac GUI model.

Currently our UIThread seems to just stop receiving readAndDispatch() messages at a certain point in our application startup and just gets stuck in the display.sleep() method.

        while (!display.isDisposed())
        {
            try
            {
                if (!display.readAndDispatch())
                {
                    display.sleep();   //Get's stuck here
                }
            }
            catch (Throwable th)
            {
                Errors.sendError(th);
                log.warn("Error thrown by UI thread:", th);
            }
        }

This leaves our main window stuck as a white square which is unpainted.  Any debugging ideas?  This loop does iterate about 20 times, so the event loop isn't broken to start with...

On Tue, May 26, 2009 at 11:58 PM, Phil Borlin <rancidfishbreath@xxxxxxxxx> wrote:
I use Java3D (which requires an AWT Frame) in my RCP app using Cocoa and the transition from Carbon to 32-bit Cocoa was completely painless.  I get MouseEvents just fine although I don't use the keyboard in the AWT part of my app so I can't vouch for that.

Phil


On Tue, May 26, 2009 at 9:54 AM, Scott Kovatch <skovatch@xxxxxxxxx> wrote:



On 5/26/09 8:23 AM, "Ben Staniford" <ben@xxxxxxxxxxxxx> wrote:

> I've just tried to get the application I work on to run with JDK1.6 and the 64
> bit Cocoa SWT library on MacOSX.  However, when I ran it, the GUI just hung in
> a horrible half running state.
>
> It looked like previous problems I'd experienced with the Carbon library, to
> do with the GUI event loop needing to run on Thread-0.  With the carbon
> library it was possible to specify -XstartOnFirstThread to ensure that the GUI
> stuff was handled by thread 0, but with the cocoa library that option doesn't
> seem to make any difference.

Yes, you will still need -XstartOnFirstThread in Cocoa.  Are you mixing AWT
and SWT in your application? I'm concerned that the AWT may not be coping
with the SWT now being a Cocoa application.

Let's rule that out before debugging things any further.

-- Scott K.

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev




--
Ben Staniford
Web:    http://www.staniford.net
Phone:  +44 (0) 151 638 0725
Mobile: +44 (0) 7891 842962

Back to the top