Re: Question about new functions in GDK 2.11



On 6/6/07, Tomasz Jankowski <tomcioj gmail com> wrote:
Hi!

My question isn't really important, I'm only curious ;P

Why did you add functions below to GDK?
gdk_threads_add_idle gdk_threads_add_idle_full gdk_threads_add_timeout
gdk_threads_add_timeout_full If we write multi thread aplication in GTK+ we
surround gtk_main () function with gdk_threads_enter () and
gdk_threads_leave (), so any call of g_idle_add... or g_timeout... functions
will be automatically thread safe, am I right?

Can someone explain it for me?

There are some hints in the documentation of these new functions.

The problem is with scenarios where thread B installs an idle in the
main loop thats running in thread A and passes user data to it. Thread
B then later frees the user data and removes the idle. There is a race
between the idle being run in thread A and the user data being freed
in thread B.



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