Re: gdk/gtk+ win32 thread question, please help to explain



On Wed, Nov 23, 2011 at 11:06 AM, KC <kcc1967 gmail com> wrote:
Hi,

According to http://developer.gnome.org/gdk/stable/gdk-Threads.html

...
Unfortunately the above holds with the X11 backend only. With the Win32 backend,
GDK calls should not be attempted from multiple threads at all.
...

The "Unfortunately ..." statement does not mention GTK+, only GDK.
Does it only apply to GDK Win32 ? ÂOr it applies to both GDK and GTK+ ?

In my application, I call gtk_list_store_newv() from many non-main threads
(not via idle, timeout callback) and I do protect the GTK call with
gdk_threads_enter/leave(). ÂIt works fine even on Win32 !!

Do I doing the right thing ? or just has good luck ?

In fact, the example "gtk-thread.c"  provide by
http://developer.gnome.org/gdk/stable/gdk-Threads.html

works fine on WIN32 too, and it calling GTK+ API from different threads
(not from main-thread via idle callback) !!

So the "Unfortunately ..." statement only apply to GDK on WIN32 ?
It's safe to call GTK+ APIs (if protected by gdk_threads_enter/leave)
from multi-threads even on WIN32 backend ? Is this correct ?


Attachment is gtk-thread.c with a little modification (change pthread
by GThread).

Best Regards,
KC




Best Regards,
KC



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