-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 9/19/2005 9:11 AM, Tristan Van Berkom wrote: > Felix Kater wrote: > [...] > >> 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).
[snip: rather long-winded explanation] To put it simply, assuming you've initialised gthread and GDK's thread system, here are the places you need to use gdk_threads_enter()/gdk_threads_leave() pairs: 1. In main(), surrounding gtk_main() (or all gtk/gdk calls, if you create threads in main() before calling gtk_main()). 2. In functions invoked via the GSource mechanism (e.g., g_idle_add(), g_timeout_add(), etc.). 3. In functions invoked in any thread that is not the main thread. This is all assuming you're calling gtk/gdk functions. If, for example, you have an idle function that does not call gtk/gdk functions, there's no need to acquire the GDK lock. In any other case (including gtk signal callbacks), you do *not* need to acquire the GDK lock. -brian -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (MingW32) iD8DBQFDL5W86XyW6VEeAnsRAvv4AKDLypn9gMYgq51YlnLqDmW5On1sAwCgpRc9 41y5WA/s69JZ+4eGodiFRDg= =22hD -----END PGP SIGNATURE----- _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list