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



I use something like this:

#define GLC_THREADS_ENTER(bThread)  if(bThread) \
           gdk_threads_enter()
#define GLC_THREADS_LEAVE(bThread)  if(bThread) \
           gdk_threads_leave()
 
int func(gbooleadn bIsThread)
{
    .... bla bla bla....
    GLC_THREADS_ENTER(bIsThread);
    
        // normal gdk_thread_enter/leave here
    ....
    GLC_THREADS_LEAVE(bIsThread);

    return 0;
}

        Saludos. Pablo.

----- Original Message ----- 
From: "Stefan Kost" <ensonic hora-obscura de>
To: <gtk-app-devel-list gnome org>
Sent: Thursday, February 10, 2005 6:20 PM
Subject: gdk_threads_enter/leave() in threaded and non threaded situation


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)?

#0  0xffffe410 in ?? ()
#1  0xbfffde28 in ?? ()
#2  0x00000002 in ?? ()
#3  0x00000000 in ?? ()
#4  0x403c1cce in __lll_mutex_lock_wait () from /lib/tls/libpthread.so.0
#5  0x403bea4d in _L_mutex_lock_33 () from /lib/tls/libpthread.so.0
#6  0xbfffde34 in ?? ()
#7  0x07735940 in ?? ()
#8  0x40709088 in ?? () from /opt/gnome/lib/libgdk-x11-2.0.so.0
#9  0x0861c4c8 in ?? ()
#10 0x084d46f0 in ?? ()
#11 0xbfffde38 in ?? ()
#12 0x406aed5c in gdk_threads_impl_lock () from 
/opt/gnome/lib/libgdk-x11-2.0.so.0
#13 0x406aed5c in gdk_threads_impl_lock () from 
/opt/gnome/lib/libgdk-x11-2.0.so.0
#14 0x406aece4 in gdk_threads_enter () from 
/opt/gnome/lib/libgdk-x11-2.0.so.0
#15 0x080649c0 in on_sequence_tick (sequence=0x8559940, arg=0x8332d78, 
user_data=0x84d46f0) at main-statusbar.c:78
#16 0x407baf7e in g_cclosure_marshal_VOID__PARAM () from 
/opt/gnome/lib/libgobject-2.0.so.0
#17 0x407acbfb in g_closure_invoke () from 
/opt/gnome/lib/libgobject-2.0.so.0
#18 0x407bdfb0 in signal_emit_unlocked_R () from 
/opt/gnome/lib/libgobject-2.0.so.0
#19 0x407bf68a in g_signal_emit_valist () from 
/opt/gnome/lib/libgobject-2.0.so.0
#20 0x407bf9b2 in g_signal_emit () from /opt/gnome/lib/libgobject-2.0.so.0
#21 0x407b4895 in g_object_dispatch_properties_changed () from 
/opt/gnome/lib/libgobject-2.0.so.0
--
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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