views:

139

answers:

1

When I add many different timeouts (with each intervall==0) in a thread, which is not the main thread (where gtk_main() resides)...

g_timeout_add(0, func, NULL);

... will then the different func() callbacks occur in the same order I called the corresponding g_timeout_add()'s?


The reason I'm asking is because GTK# is using internally timeouts to implement Application.Invoke() (see Application.cs and Timeout.cs).


EDIT: The concerning glib files are

+3  A: 

Internally, g_timeout_add calls g_hook_insert_sorted. If g_timeout_add_full is used, the priority determines the ordering, otherwise the hook is added at the end of the list. Hooks are executed in order, so when only g_timeout_add is used, the answer is yes.

Unfortunately, there is not no explicit guarantee, and to me, it looks like an implementation detail which might change in the future.

Koert
OK. But I cannot really find a call to `g_hook_insert_sorted()` inside *gmain.c* (I added a link in the question)?
ulrichb