Re: callback functions...signals ...events... process communications



On Fri,  5 Nov 2004 17:21:50 -0200, viola das inpe br <viola das inpe br> wrote:

   Hi everybody!
    I am francisco viola; this is my first time; they say that I'll never forget...
      So, I would like to know if I could attach a callback function to a signal
or event (?) that is fired (I mean "signaled") from inside another program
running in parallel? And how could this program pass a string to the callback
function, just before the signal firing? Does gtk offer some gadget to do these?

   There is no IPC mechanism provided out of the box in Gtk+, I've always had 
to write my own. Generaly, I usualy use unix sockets if I know I'm
running on the
same machine, but network sockets can work as well (socket, bind, accept, 
read, write kind of thing). Up till now, I've always used GIOChannel
to add these
sockets as event sources (GSource) to the main loop (GIOWatch), I think there is
some kind of merge comming from the GNet library that will be integrated into
gtk+ (I'm not 100% sure...).

Note that signal handleing is a dangerous way of implementing IPC 
(because of the multi-threaded aspect of process interruption) its generaly
safer to used sockets, pipes and standard communication channels
(and not a pain-in-the-arse like signals).

HTH,

Cheers,
                                                        -Tristan



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