00001 00007 /* 00008 * Copyright (C) 2003 Bregmasoft 00009 * 00010 * This program is free software; you can redistribute it and/or modify it under 00011 * the terms of the GNU General Public License as published by the Free Software 00012 * Foundation; either version 2 of the License, or (at your option) any later 00013 * version. 00014 * 00015 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 00016 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 00017 * PARTICULAR PURPOSE. See the GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License along with 00020 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 * Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 #ifndef ZYGOMA_ATOMIC_H_ 00024 #define ZYGOMA_ATOMIC_H_ 00025 00026 #include <arch/atomic.h> // architecture-specific atomic operations 00027 #include <arch.h> // bring architecture-specific ops into scope 00028 00029 namespace Zygoma 00030 { 00036 typedef Arch::AtomicWord AtomicWord; 00037 00038 00054 ZYGOMA_ALWAYS_INLINE AtomicWord 00055 atomicExchange(volatile AtomicWord* mem, AtomicWord value) 00056 { 00057 return Arch::atomicExchange(mem, value); 00058 } 00059 00060 00076 ZYGOMA_ALWAYS_INLINE AtomicWord 00077 atomicExchangeAndAdd(volatile AtomicWord* mem, AtomicWord value) 00078 { 00079 return Arch::atomicExchangeAndAdd(mem, value); 00080 } 00081 00082 00096 ZYGOMA_ALWAYS_INLINE void 00097 atomicAdd(volatile AtomicWord* mem, AtomicWord value) 00098 { 00099 Arch::atomicAdd(mem, value); 00100 } 00101 00102 } // namespace Zygoma 00103 00104 #endif // ZYGOMA_ATOMIC_H_