When to use gdk_threads_init?



Hello, I'm new to GTK. I am using gthread with gtk both in Windows and Ubuntu.
When I using it in Windows, I will have a gdk_threads_init() in my main funciton before main loop and it works well. If I ignore it, it seems the signals from other threads will hang sometimes later.
But when I switched to Ubuntu, if I leave this gdk_threads_init() in the main function, even the main threads will be blocked when it comes to gdk_threads_enter(), and I'm sure there is no other threads I created in the critical section. If I remove the gdk_threads_init() in the main function, every thing works well again.
 
So I wonder when do I need the gdk_threads_init(). And if a thread called gdk_threads_enter(), can it calls gdk_threads_enter() again before gdk_threads_leave()?
 
Thanks!


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