question on gdk_threads_enter()



Hi, 

I am trying to figure out how to program multithreaded gtk application and I 
have a question on gtk-thread.c example on page 
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html. 

The key points in the sampe application are: 1) event loop(that is, 
gtk_main()) in GUI thread is always enclosed by gdk_thread_enter/exit() pair, 
and 2) the woker thread must call that pair of macros to get the mutex first 
and release it later on to update UI

My question is: since gtk_main() is enclosed by gdk_thread_enter/exit() pair, 
the GUI thread always hold the mutex and never release it(am I right here?), 
how can worker thread get that mutex by calling gdk_threads_enter() at all? I 
know I must misunderstand something. Can anybody throw some light on it? 
Thanks.



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