>This excerpt from the FAQ sounds like what I'm after:
>"or alternatively, ensure that only a single thread makes such calls.
>One common way to do this is to have non-GUI threads send requests to
>the GUI thread via a pipe. The pipe is hooked into the main glib event
>loop used by GTK."
>
>But I've been unable to find any simple example code for this. Could anyone
>provide a brief example?

there is no brief example. there's no "brief" way to do it. i would
point at Ardour's ViewCVS system, but the code there is complicated by
the fact that the code used has to be real-time safe, which will make
it much harder for you to understand how it works.

you need to investigate glib/glibmm functions related to IOChannels,
in particular Glib::IOChannel::create_from_fd().

you first call pipe (2) to create a uni-directional pipe, then the
readable end of the pipe and feed it to the above named
function. attach a callback to the newly-created IOChannel that
responds to the pipe/IOChannel being readable. 

from other threads, write requests to the writable end of the pipe. 

voila.

the nature of a "request" is application dependent. i have a struct a
dozen or so members that get passed back and forth, although because
of the RT issue mentioned, its not quite as simple as that.

--p
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to