RE: Does gtk have issues with STL?
- From: Chris Vine <chris cvine freeserve co uk>
- To: "Vallone, Anthony" <anthony vallone lmco com>
- Cc: gtk-list gnome org
- Subject: RE: Does gtk have issues with STL?
- Date: Wed, 13 Feb 2008 20:41:08 +0000
On Tue, 2008-02-12 at 16:19 -0500, Vallone, Anthony wrote:
> > You do not need to call gdk_thread_init()
> > if you are only invoking GDK/GTK+ functions by message passing via
> > g_idle_add() (that is, if you are not calling
> gdk_threads_enter()/leave()).
>
> That's interesting. g_idle_add() is thread safe without telling it to
> use mutex locking? Based on the docs, I've always called g_thread_init
> assuming I had to. This may have a complicated answer, but how does it
> safely manage being called by multiple threads given that it is probably
> accessing data shared by the threads?
You have omitted from your reading (and from the extract quoted in your
posting) the part of the message which said this:
"You can use pthreads under glib without problems. For Unix-like
systems, gthreads is only a wrapper for pthreads.
However, you need to call g_thread_init() to make glib (including
g_idle_add()) thread safe, whether you are using gthreads or using
pthreads directly."
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]