Re: [Java-gnome-developer] How do you fire an event on the main Gtk thread?
Brought to you by:
afcowie
From: Andrew C. <an...@op...> - 2009-01-02 07:32:53
|
On Mon, 2008-12-22 at 06:18 -0800, Jacek wrote: > In Swing, you use SwingUtilitilies.invokeLater(Runnable) for this. > In SWT, it's Display.asyncExec(Runnable). > > What is the equivalent API for Java-Gnome? There isn't one. java-gnome is thread safe. Hooray, thank god, happy new year, etc. ++ I wrote about this a long time ago; sorta surprised you missed it seeing as how it's the first hit for "java-gnome thread": http://research.operationaldynamics.com/blogs/andrew/software/java-gnome/thread-safety-for-java.html but our wonderful thread safety *is* mentioned in the public API documentation here: http://java-gnome.laptop/4.0/doc/api/org/gnome/gdk/Gdk.html and was written about in the release notes a number of times, as far back as 4.0.3 when it was introduced: http://java-gnome.sourceforge.net/4.0/NEWS.html#4.0.3 . Anyone in our IRC channel could have told you about it, I'm sure. Anyway, no messing around with idle callbacks or any other such nonsense. Just use a worker thread, but be aware that a) signal handlers run in the main thread (and are already within the GDK lock throughout), and b) holding the main lock and blocking the main loop are synonymous, so the injunction to get on with things that applies to signal handlers really applies globally. ++ Perhaps this needs to be noted a bit more prominently. We haven't worked on the website for a while, so perhaps it's time for some changes. Discussion of how best to do so to java-gnome-hackers; suggestions [in patch form] for the site always welcome. The current site is based on the 'website' branch from the usual place (although the website code is in *every* branch of java-gnome, in web/public/). AfC Sydney -- Andrew Frederick Cowie Operational Dynamics is an operations and engineering consultancy focusing on IT strategy, organizational architecture, systems review, and effective procedures for change management: enabling successful deployment of mission critical information technology in enterprises, worldwide. http://www.operationaldynamics.com/ Sydney New York Toronto London |