On Thu, 24 Sep 2009 14:32:30 -0500
Thomas Stover <tho...@wsinnovations.com> wrote:
[snip]
> For anyone in the future searching around for more info on this
> topic, here is a variation of the gtk hello world program I was doing
> some experiments with. My main question at this point to anyone who
> might know is, should the idle source get dereferenced / freed
> somehow? My other question is g_source_attach() working on another
> thread's GMainContext with atomic operations, will it possibly have
> to block for access, or I'm I not doing this in a thread safe way?

Since you call g_thread_init(), g_source_attach() is thread safe so
that is fine.  However, to get the GSource objects to clean up when
they are finished with you need to call g_source_unref() after
g_source_attach() (g_source_attach() increments the reference count).

The main loop has a mutex protecting it when sources are added or
removed or callbacks are read for dispatch.  That might block
momentarily if there is contention but nothing that you would notice.

Chris


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to