Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] Eclipse beginner threading question...


Hi Horst,

Display.asyncExec(Runnable runnable) should be analogous to SwingUtilities.invokeLater(Runnable runnable). From the Display javadocs:

/**
* Causes the <code>run()</code> method of the runnable to
* be invoked by the user-interface thread at the next
* reasonable opportunity. The caller of this method continues
* to run in parallel, and is not notified when the
* runnable has completed.

The purpose is the same as SwingUtilities.invokeLater(), to request that the gui thread execute some code (the request being queued from another thread). Maybe there's another cause for your exception?

- Russ

Hi Russ,

Thanks for your reply. But I am still stuck. My problem is that I have a listener and it gets notifed when a change has occurred in the model. The listener is being notified in a non gui thread. So when I am notified of the change it is on a non ui thread. I then am trying to call the line of code you have suggested

getSite().getShell().getDisplay().asyncExec(runnable);

from this non ui thread. It then crashes because evidently this is not legal. I guess what I am looking for is some utility or method that I can say run this on the UI thread but I can call the utility or method from this background thread. Something like Swingutilities,.invokeLater in swing.

-- Horst




Back to the top