I'm trying to add a timeout source specific to a particular GThread.
In the main thread, I can create a GMainContext (g_main_context_new) and add a timeout (g_timeout_add). However, when I try to do it in a thread created with g_thread_create it simply doesn't work, the GSourceFunc is never called and I have no clue why.
For the moment I've only got this the documentation:
Callbacks require a bit of attention. Callbacks from GTK+ (signals) are made within the GTK+ lock. However callbacks from GLib (timeouts, IO callbacks, and idle functions) are made outside of the GTK+ lock. So, within a signal handler you do not need to call gdk_threads_enter(), but within the other types of callbacks, you do.
But my timeout function (for testing purposes) only prints in the console, so I don't think it's a problem of resource protection and mutexes.
The thread structure is:
Main thread --> no GLib main context explicitly created
capture thread
process thread --> should have a GLib main context and a timeout source
show thread
I appreciate any help.
Thanks in advance.