Re: gdk_threads_enter/leave() in threaded and non threaded situation



On Thu, 10 Feb 2005 22:20:51 +0100, Stefan Kost <ensonic hora-obscura de> wrote:
hi hi,

I have a gobject property that is set (via g_object_set()) from within a
thread and from the main thread.
Further I have signal handlers that watch this via notify::property.
These signal handler call gtk functions. Therefore in these signal
handlers the gtk part is wrapped with gdk_threads_enter/leave().
When the singnal is triggered from the thread it works, but when it gets
triggerd from the main thread gdk_threads_enter blocks.

This is quite obvious, as in this thread I am already in
gdk_threads_enter(). But how should the signal handler know that (wheter
it has been triggered from the main thread or from another thread)?

Maybe you should protect g_object_set() with gdk_threads_mutex and
assume that when you are in a signal callback, that you already have
aquired the mutex (which should be the case for any signal emited by gtk+
anyway).

Cheers,
                                                -Tristan



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