I'm having difficulties waking up my main loop from a worker thread. I'm doing the following in the worker thread in order to have myfunc() called from the main thread:
However, myfunc() isn't called immediately. I have to move the mouse over some of my windows in order to wake up the main loop and then it will call myfunc(). Without moving the mouse or doing anything else that will cause the main loop to wake up, myfunc() won't get called. I also tried the following but it doesn't work either:
g_timeout_add(1, myfunc, myargs);
This shows the same behaviour as above. myfunc() will only get called if I do something that causes the main loop to wake up.
The main loop looks like this:
loop = g_main_loop_new(NULL, FALSE);
while(!quit) g_main_context_iteration(NULL, TRUE);
Any ideas what is wrong here?