On Mon, 2010-03-01 at 10:35 +0000, James Morris wrote:

Hi,

> I need to use an atomic pointer for my app. The documentation for the glib
> atomic operations is not exactly helpful.
> 
> Anyway, I wrote a test program:
>     g_atomic_pointer_set(&myptr, str);
>     char* p = g_atomic_pointer_get(&myptr);
>
> (...) to understand what was meant to be used as the parameters. Anyway,
> the output of this does not look at all atomic: (not that i'm any expert)
> 
>     ((void) (*(&myptr) = (str)));
>     char* p = ((gpointer)*(&myptr));
>
> This is on a x86_64, running Gentoo, glib-2.20.5.
> 
> I don't know if I've got the idea right for how these functions are
> supposed to be used. Any ideas?

This should be ok in your case, it may expand to something else on other
platforms though.

Cheers
 -Tim


_______________________________________________
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