1.1 --- a/epoc32/include/stdapis/glib-2.0/glib/gatomic.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/glib-2.0/glib/gatomic.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,70 @@
1.4 -gatomic.h
1.5 +/* GLIB - Library of useful routines for C programming
1.6 + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
1.7 + *
1.8 + * g_atomic_*: atomic operations.
1.9 + * Copyright (C) 2003 Sebastian Wilhelmi
1.10 + * Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
1.11 + *
1.12 + * This library is free software; you can redistribute it and/or
1.13 + * modify it under the terms of the GNU Lesser General Public
1.14 + * License as published by the Free Software Foundation; either
1.15 + * version 2 of the License, or (at your option) any later version.
1.16 + *
1.17 + * This library is distributed in the hope that it will be useful,
1.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.20 + * Lesser General Public License for more details.
1.21 + *
1.22 + * You should have received a copy of the GNU Lesser General Public
1.23 + * License along with this library; if not, write to the
1.24 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1.25 + * Boston, MA 02111-1307, USA.
1.26 + */
1.27 +
1.28 +/*
1.29 + * Modified by the GLib Team and others 1997-2000. See the AUTHORS
1.30 + * file for a list of people on the GLib Team. See the ChangeLog
1.31 + * files for a list of changes. These files are distributed with
1.32 + * GLib at ftp://ftp.gtk.org/pub/gtk/.
1.33 + */
1.34 +
1.35 +#ifndef __G_ATOMIC_H__
1.36 +#define __G_ATOMIC_H__
1.37 +
1.38 +#include <_ansi.h>
1.39 +#include <glib/gtypes.h>
1.40 +
1.41 +G_BEGIN_DECLS
1.42 +
1.43 +IMPORT_C gint g_atomic_int_exchange_and_add (volatile gint *atomic,
1.44 + gint val);
1.45 +IMPORT_C void g_atomic_int_add (volatile gint *atomic,
1.46 + gint val);
1.47 +IMPORT_C gboolean g_atomic_int_compare_and_exchange (volatile gint *atomic,
1.48 + gint oldval,
1.49 + gint newval);
1.50 +IMPORT_C gboolean g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
1.51 + gpointer oldval,
1.52 + gpointer newval);
1.53 +
1.54 +IMPORT_C gint g_atomic_int_get (volatile gint *atomic);
1.55 +IMPORT_C void g_atomic_int_set (volatile gint *atomic,
1.56 + gint newval);
1.57 +IMPORT_C gpointer g_atomic_pointer_get (volatile gpointer *atomic);
1.58 +IMPORT_C void g_atomic_pointer_set (volatile gpointer *atomic,
1.59 + gpointer newval);
1.60 +
1.61 +#ifndef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED
1.62 +# define g_atomic_int_get(atomic) (*(atomic))
1.63 +# define g_atomic_int_set(atomic, newval) ((void) (*(atomic) = (newval)))
1.64 +# define g_atomic_pointer_get(atomic) (*(atomic))
1.65 +# define g_atomic_pointer_set(atomic, newval) ((void) (*(atomic) = (newval)))
1.66 +#endif /* G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */
1.67 +
1.68 +#define g_atomic_int_inc(atomic) (g_atomic_int_add ((atomic), 1))
1.69 +#define g_atomic_int_dec_and_test(atomic) \
1.70 + (g_atomic_int_exchange_and_add ((atomic), -1) == 1)
1.71 +
1.72 +G_END_DECLS
1.73 +
1.74 +#endif /* __G_ATOMIC_H__ */