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

GTK+/Swing: Multithreading



I just finished reading an article "Swing and Multithreading" in Nov98 Java
Report. It describes why Swing is not threadsafe, which is pretty much the same
reasons GTK+ cites.

Basically, Swing also recommends that once widgets get painted, they only be
manipulated via the event-dispatch thread. That, I understand, is GTK+'s
recommendation also.

However, Swing has two useful utility functions: InvokeLater and InvokeAndWait.
Each requires a Runnable, which is to say it executes arbitrary code; the former
at a later time, the latter in a blocking call. That code is executed in the
context of the event-dispatch thread.

This means that a non-UI thread has a means of invoking UI code. This strikes me
as being an adequately elegant solution to the problem of accessing the UI from
a non-UI thread in Swing.

So my question is simple: is there a similar facility in GTK+?

-- 
SEGV    http://www.cgocable.net/~mlepage/



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