GTK peer thread safety

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A few weeks ago, someone in #classpath mentioned in passing that they
had managed to make the GTK peer for the classpath project's AWT
implementation "thread safe".

I assume by this they meant that they had implemented it in such a way
that it was not limited by the usual limitation of graphical user
interface widget toolkits that changes to GUI elements must be done from
within the main event loop of the GUI framework.

I've long been annoyed at the limitation, which seems to be particularly
obtuse in the face of magnificently easy threading in Java.

In the java-gnome bindings, libgtk-java has a mechanism which allows you
to add a Runable to be called back to in order that a code fragment will
be executed from within the main loop thread in the next main loop
iteration. This mechanism, called "CustomEvents" is crude and ugly, but
there you go.

Fast forward a whole bunch of years to today: now that I've inherited
java-gnome and have embarked on a significant rewrite (ie, API break), a
number of cumbersome APIs can be fixed: improving (or better yet
removing) the CustomEvents hack is high on my list of targets.

I've been wading through the murk of the glib API documentation, and not
really getting anywhere. I imagine the issue involves either:
        
        a) how you relate G threads to Java ones, or
        
        b) somehow obtaining the "main lock" directly without causing a
        race condition, or
        
        c) doing some kind of async dispatch behind the scenes, or
        
        d) all of the above, or
        
        e) something else :)

So, whoever you are, by thread safety do you mean "can call GUI changing
methods from anywhere" or something else? If the former, how did you do
it?

I'd say contact me directly off list, except that whatever you did for
the GTK peer sounds impressive and I'm sure others would be interested
to hear too.

AfC
Sydney

-- 
Andrew Frederick Cowie

Technology strategy, managing change, establishing procedures,
and executing successful upgrades to mission critical business
infrastructure.

http://www.operationaldynamics.com/

Sydney   New York   Toronto   London

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux