Re: widget's signal callback: inside gdk lock?



On 9/19/05, Tristan Van Berkom <tvb gnome org> wrote:
Fe Kater wrote:
Hi,

I wonder if the callback function I connect to a widget's signal (like
"toggled" signal of a checkbutton) is already inside the gdk lock--or if I
have to take care of gdk_threads_enter/leave with any code inside this
callback function?

     Since signals are run synchronously (i.e. they are not deffered to
the main loop as events, as some tend to imagine) they are always the
result of the signal's object being accessed, so if the object is a gdk
or gtk object; then the lock must be aquired first (making those signal
callbacks run inside the lock).

Thanks a lot--I am afraid, though, I didn't understand the explanation
and so could misunderstand your answer... What do you mean by "then
the lock must be aquired first" (assuming a mouse click to the gtk
object checkbutton and a callback connected to the "toggled" signal):

a. The lock is already aquired by gtk when the button is toggled by
the user's mouse click--so the callback is already (automatically)
inside the lock from the client programmer's view.

b. The lock has to be aquired explicitly by the client programmer who
is using gtk (in case she wants to access other gtk stuff savely).

Felix



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