Click to See Complete Forum and Search --> : GTK+ signal priority


tecknophreak
08-05-2003, 03:22 PM
If I have a gtk_timeout_add and a g_signal_connect(writing this, I have to check for g_timeout_add), which one has higher priority?

Two examples,

Someone presses a button causing a signal, while the handler's handling, a timeout occurs. Does the signal handler get interrupted by the timeout handler or does the signal handler complete and the timeout handler get called after the signal handler finishes?

From reading about these handlers, it looks like the signal handler will finish then it will go back into gtk_main which will call the timeout handler.

Is this right?

The second example was just the handlers situation above reversed.

bwkaz
08-06-2003, 07:29 PM
One of those two functions (I think g_signal_connect, though maybe not) has a form where you specify the priority yourself.

You could look into the Gtk source, too, to see what the priority on the other one is.

But I'm pretty sure that Gtk is still single-threaded. Which means that regardless of what's going on, if your code is running when a timeout happens, Gtk waits until you return to gtk_main before running the registered callback. At no time does it interrupt processing to run anything.

The priority only applies to what happens when two different events both happen while your code is running. If you have two timeouts, for example, they might both expire while your code is running. In that case, the one with the higher priority will have its callback happen first.