libstdc++
|
00001 // Low-level type for atomic operations -*- C++ -*- 00002 00003 // Copyright (C) 2004-2014 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 3, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 #ifndef _GLIBCXX_ATOMIC_WORD_H 00026 #define _GLIBCXX_ATOMIC_WORD_H 1 00027 00028 #ifdef __arch64__ 00029 typedef long _Atomic_word; 00030 #else 00031 typedef int _Atomic_word; 00032 #endif 00033 00034 #if defined(__sparc_v9__) 00035 // These are necessary under the V9 RMO model, though it is almost never 00036 // used in userspace. 00037 #define _GLIBCXX_READ_MEM_BARRIER \ 00038 __asm __volatile ("membar #LoadLoad":::"memory") 00039 #define _GLIBCXX_WRITE_MEM_BARRIER \ 00040 __asm __volatile ("membar #StoreStore":::"memory") 00041 00042 #elif defined(__sparc_v8__) 00043 // This is necessary under the PSO model. 00044 #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("stbar":::"memory") 00045 00046 #endif 00047 00048 #endif