diff options
Diffstat (limited to 'contrib/libstdc++/config/os/aix/atomicity.h')
-rw-r--r-- | contrib/libstdc++/config/os/aix/atomicity.h | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/contrib/libstdc++/config/os/aix/atomicity.h b/contrib/libstdc++/config/os/aix/atomicity.h index af4fa5a..dad8aae 100644 --- a/contrib/libstdc++/config/os/aix/atomicity.h +++ b/contrib/libstdc++/config/os/aix/atomicity.h @@ -1,6 +1,6 @@ // Low-level functions for atomic operations: AIX version -*- C++ -*- -// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -27,33 +27,35 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#ifndef _BITS_ATOMICITY_H -#define _BITS_ATOMICITY_H 1 +#include <bits/atomicity.h> /* We cannot use the cpu/powerpc/bits/atomicity.h inline assembly definitions for these operations since they depend on operations that are not available on the original POWER architecture. AIX still runs on the POWER architecture, so it would be incorrect to - assume the existence of these instructions. */ + assume the existence of these instructions. -/* This should match the type pointed to by atomic_p in - <sys/atomic_op.h>. */ -typedef int _Atomic_word; + The definition of _Atomic_word must match the type pointed to by + atomic_p in <sys/atomic_op.h>. */ -#include <sys/atomic_op.h> - -static inline int -__attribute__ ((__unused__)) -__exchange_and_add (atomic_p __mem, int __val) +extern "C" { - return fetch_and_add (__mem, __val); +#include <sys/atomic_op.h> } -static inline void -__attribute__ ((__unused__)) -__atomic_add (atomic_p __mem, int __val) +namespace __gnu_cxx { - (void) fetch_and_add (__mem, __val); -} - -#endif /* atomicity.h */ + _Atomic_word + __attribute__ ((__unused__)) + __exchange_and_add (volatile _Atomic_word* __mem, int __val) + { + return ::fetch_and_add (const_cast<atomic_p>(__mem), __val); + } + + void + __attribute__ ((__unused__)) + __atomic_add (volatile _Atomic_word* __mem, int __val) + { + (void) ::fetch_and_add (const_cast<atomic_p>(__mem), __val); + } +} // namespace __gnu_cxx |