Re: gdk_threads_enter/leave() in threaded and non threaded situation (SOLVED)



just a closing follow up. I found a solution in rythmbox sources :

static GThread *main_thread = NULL;

void rb_thread_helpers_init (void) {
   main_thread = g_thread_self ();
}

gboolean rb_thread_helpers_in_main_thread (void) {
   return (main_thread == g_thread_self ());
}

void rb_thread_helpers_lock_gdk (void) {
   if (!rb_thread_helpers_in_main_thread ())  gdk_threads_enter ();
}

void rb_thread_helpers_unlock_gdk (void) {
   if (!rb_thread_helpers_in_main_thread ()) gdk_threads_leave ();
}




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