Query about handling OS signals

I have spent most of a day looking at the various documents about
emitting signals and articles here without finding the answers to the
questions - sorry if they seem stupid as I'm a comparative newcomer to

I am converting an application to use GTK+ which receives messages from
a daemon process using signals - i.e. OS signals not the signals in GTK.

The signals are sent by the daemon process to tell the receiving clients
"you might want to refresh your display". It is for the receiving
clients to worry about whether they do need to refresh their displays
(the actual data is in shared memory).

My first question is: Is it safe to emit a signal (i.e. the GTK idea of
a signal) within the OS-signal handling routine?

If not, it looks as if the only standard way is to have the OS
signal-catching routine just turn on "had_a_signal" and use
g_timeout_add to call a function which looks at "had_a_signal". Or is
there a better way?

If it is OK to emit a signal please could someone confirm my
understanding of "events" in GTK. (I'd appreciate it if someone could
confirm my understanding in any case).

Am I right in thinking that if I want to emit a client event (which
seems to be an appropriate thing to emit) I can either put:

        g_signal_emit_by_name(G_OBJECT(window), "client_event");

Or I set up a GdkEvent and put

        g_signal_emit_by_name(G_OBJECT(window), "event", &event,

Unfortunately the documentation such as there is talks about using
gtk_signal_emit_by_name but the documentation of that says it's
deprecated and I should use g_signal_emit_by_name.

Or is there is some altogether better way of doing all this that I
haven't thought of? Please note rewriting the daemon process is not
currently an option.

John Collins <jmc xisl com> Skype: toadwarbler
Xi Software Ltd www.xisl.com 

Tel: +44 (0)1707 886110 (Direct)
     +44 (0)7799 113162 (Mobile)

Registered in England & Wales Company Number 1977148 VAT: GB 403 9239 64

Trading Address: 3 Mandeville Rise, Welwyn Garden City, Herts, AL8 7JT, UK
Reg Office: 2 Mill Road, Haverhill, Suffolk, CB9 8BD, UK

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