Re: gdk threads ...



On Wed, 25 Apr 2012 14:39:24 -0400
Paul Davis <paul linuxaudiosystems com> wrote:
> i've never seen anyone remark that  attaching a timeout (or other
> source) to a main loop is thread safe. if it is, then great.  i was
> under the impression that g_idle_add() was special ...

All the main loop sources are thread safe (and the glib documentation
explicitly so states).

Of course, any data you attach to the callback's data argument is not
protected (except that main loop locking will ensure memory ordering
and visibility), but that applies to idle callbacks as well as to the
others; so the message-passing thread either hands over ownership of
the data to the callback and never touches it again, or it is treated
as immutable by both threads.

Chris


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