I have read the Tip about using Ruby threads with GTK
(http://ruby-gnome2.sourceforge.jp/hiki.cgi?tips_threads), and I have
a few questions that I hope you can help me with.
First, since all Ruby code (in 1.8.6 at least) runs from within the
same system thread, why does GTK care about which Ruby thread it is
called from? Don’t all Ruby threads just appear to be one thread to
Second, the tip says that we must call GTK methods from within the
main thread. Is it possible instead to use the Gdk::Threads.enter and
Gdk::Threads.leave to surround GTK code? Other GTK bindings (PyGTK and
Java-GNOME) have used these methods:
And if it is indeed possible to use these methods, can we use a
similar technique to Java-GNOME to make Ruby-GNOME threadsafe?
Finally, does anyone know a quick way to make Ruby-GNOME segfault with
threads? Because I’d like to test out how these things work for
myself, so I can understand the techniques better.