1132720Skan// Low-level type for atomic operations -*- C++ -*- 2132720Skan 3132720Skan// Copyright (C) 2004 Free Software Foundation, Inc. 4132720Skan// 5132720Skan// This file is part of the GNU ISO C++ Library. This library is free 6132720Skan// software; you can redistribute it and/or modify it under the 7132720Skan// terms of the GNU General Public License as published by the 8132720Skan// Free Software Foundation; either version 2, or (at your option) 9132720Skan// any later version. 10132720Skan 11132720Skan// This library is distributed in the hope that it will be useful, 12132720Skan// but WITHOUT ANY WARRANTY; without even the implied warranty of 13132720Skan// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14132720Skan// GNU General Public License for more details. 15132720Skan 16132720Skan// You should have received a copy of the GNU General Public License along 17132720Skan// with this library; see the file COPYING. If not, write to the Free 18169691Skan// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 19132720Skan// USA. 20132720Skan 21132720Skan// As a special exception, you may use this file as part of a free software 22132720Skan// library without restriction. Specifically, if other files instantiate 23132720Skan// templates or use macros or inline functions from this file, or you compile 24132720Skan// this file and link it with other files to produce an executable, this 25132720Skan// file does not by itself cause the resulting executable to be covered by 26132720Skan// the GNU General Public License. This exception does not however 27132720Skan// invalidate any other reasons why the executable file might be covered by 28132720Skan// the GNU General Public License. 29132720Skan 30169691Skan/** @file atomic_word.h 31169691Skan * This file is a GNU extension to the Standard C++ Library. 32169691Skan */ 33169691Skan 34132720Skan#ifndef _GLIBCXX_ATOMIC_WORD_H 35132720Skan#define _GLIBCXX_ATOMIC_WORD_H 1 36132720Skan 37132720Skantypedef int _Atomic_word; 38132720Skan 39169691Skan// Define these two macros using the appropriate memory barrier for the target. 40169691Skan// The commented out versions below are the defaults. 41169691Skan// See ia64/atomic_word.h for an alternative approach. 42169691Skan 43169691Skan// This one prevents loads from being hoisted across the barrier; 44169691Skan// in other words, this is a Load-Load acquire barrier. 45169691Skan// This is necessary iff TARGET_RELAXED_ORDERING is defined in tm.h. 46169691Skan// #define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("":::"memory") 47169691Skan 48169691Skan// This one prevents stores from being sunk across the barrier; in other 49169691Skan// words, a Store-Store release barrier. 50169691Skan// #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("":::"memory") 51169691Skan 52132720Skan#endif 53