From the source definition, it seems you can only attach GSource to one GMainContext
struct _GSource
{
/*< private >*/
gpointer callback_data;
GSourceCallbackFuncs *callback_funcs;
const GSourceFuncs *source_funcs;
guint ref_count;
GMainContext *context; // <<<<<
gint priority;
guint flags;
guint source_id;
GSList *poll_fds;
GSource *prev;
GSource *next;
char *name;
GSourcePrivate *priv;
};
Take a look
static guint
g_source_attach_unlocked (GSource *source,
GMainContext *context,
gboolean do_wakeup)
who will tell you that only the bound will be awakened GMainContext.
Example derived GSourceuse: https://github.com/chergert/iris/blob/master/iris/iris-gsource.c
source
share