g_timeout_add to a context



Hi,
Is there any good motivation for the lack of the GMainContext argument
from "g_timeout_add" ?

Is there any counter-indication for the addition of a function like
the following to "gmain" ?

-----------------------------------------
guint g_timeout_add_to_context(guint interval, GSourceFunc function,
gpointer data, GMainContext *context) {
   GSource *source;
   guint id;

   g_return_val_if_fail(function != NULL, 0);
   source = g_timeout_source_new(interval);
   g_source_set_callback(source, function, data, NULL);
   id = g_source_attach(source, context);
   g_source_unref(source);

   return id;
}
-----------------------------------------

Does make any sense to add a Bugzilla feature request for the addition
of this function ?

In my opinion, it is quite useful in multi-threaded applications where
different threads have to use a separate main loop.

Regards,
Emilio



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