c - GTK: Delegate function call to main thread -
i'm having problems delegating function call main thread worker thread. since can't call gtk worker thread, want delegate call main thread me. function should called possible on main thread.
i tried following:
g_idle_add(myfunc, myargs); g_main_context_wakeup(null); but doesn't work. myfunc() not called when other input arrives seems trigger main loop. don't see why doesn't work. shouldn't g_main_context_wakeup() wakeup main loop?
my main loop looks this:
loop = g_main_loop_new(null, false); while(!quit) g_main_context_iteration(null, true); any ideas?
to answer own question, didn't work because i'm on old gtk version requires multithreading explicitly enabled calling g_thread_init() first. once call g_thread_init(), g_main_context_wakeup() works fine now.
Comments
Post a Comment