RE: Does gtk have issues with STL?



Myself, I avoid the enter/leave calls in favor of g_idle_add() as a
mechanism to queue all gui calls for the main event loop thread.  Let
your other threads stick to performing the non-gui work, and you'll save
yourself from many headaches. (I wish someone told me that 3 years ago).

BTW, I always use STL and GTK+ together.  Never had a problem.


-----Original Message-----
From: gtk-list-bounces gnome org [mailto:gtk-list-bounces gnome org] On
Behalf Of Lindley M French
Sent: Monday, February 11, 2008 5:23 PM
To: gtk-list gnome org
Subject: Re: Does gtk have issues with STL?

I had already figured out that widgets had to be created in the main
thread, or else the event loop wouldn't handle them. I did not realize
that one had to be careful with updating widgets as well! That explains
a few things.

So gdk_threads_enter() should be called around data updates. But is that
called automatically in default signal handlers, or do I need to put it
there myself as well? It feels odd locking only one thread explicitly.

Also, may I assume that calls made in the thread containing the event
loop don't need this protection?

----- Original Message -----
From: Paul Davis <paul linuxaudiosystems com>
Date: Monday, February 11, 2008 4:49 pm
Subject: Re: Does gtk have issues with STL?

> 
> On Mon, 2008-02-11 at 15:45 -0500, Lindley M French wrote:
> 
> > I suspect these are merely symptoms of some other corruption,
> but I can't seem to find it.
> 
> with a 99.872% confidence level, i can confirm your belief.
> 
> > I'm using pthreads with this; nothing complex, and I think I
> have everything mutex'd, but it did make me wonder: Does GTK use 
> gthreads internally, and is there any issue with using gthreads and 
> pthreads at the same time?
> 
> if you don't understand the answer to this already, it suggests that 
> it may be unwise for you to be using threads at all.
> 
> the use of threads in GUI toolkits that originated in the X Window 
> worldis generally quite difference than the use of it with GUI 
> toolkits that originated in the win32 world. in particular, the 
> general rule in GTK
> is:
> 
>  EITHER make GTK/GDK/X11 calls from a single thread only OR  use 
> GDK_THREADS_{ENTER,LEAVE} around every (group of) GTK/GDK/X11  
> call(s).
> 
> googling will turn up plenty of refs to this stuff.
> 
> 
> > Also: Is it bad to emit a signal while in a signal handler
> callback? In this case I'd like to make sure a scrollbar value- update

> takes place every time a bounds-update does.
> 
> in general, its not a problem. there are some specific instances where

> it can be an issue.
> 
> 
> 
> 
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list


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