libstdc++
|
00001 // -*- C++ -*- header. 00002 00003 // Copyright (C) 2008, 2009 00004 // Free Software Foundation, Inc. 00005 // 00006 // This file is part of the GNU ISO C++ Library. This library is free 00007 // software; you can redistribute it and/or modify it under the 00008 // terms of the GNU General Public License as published by the 00009 // Free Software Foundation; either version 3, or (at your option) 00010 // any later version. 00011 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 00017 // Under Section 7 of GPL version 3, you are granted additional 00018 // permissions described in the GCC Runtime Library Exception, version 00019 // 3.1, as published by the Free Software Foundation. 00020 00021 // You should have received a copy of the GNU General Public License and 00022 // a copy of the GCC Runtime Library Exception along with this program; 00023 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00024 // <http://www.gnu.org/licenses/>. 00025 00026 /** @file bits/atomicfwd_c.h 00027 * This is an internal header file, included by other library headers. 00028 * You should not attempt to use it directly. 00029 */ 00030 00031 // "C" only bits. 00032 00033 #define _ATOMIC_MEMBER_ ((__a)->_M_i) 00034 00035 // POD base classes for atomic intgral types. 00036 struct __atomic_bool_base 00037 { 00038 bool _M_i; 00039 }; 00040 00041 struct __atomic_char_base 00042 { 00043 char _M_i; 00044 }; 00045 00046 struct __atomic_schar_base 00047 { 00048 signed char _M_i; 00049 }; 00050 00051 struct __atomic_uchar_base 00052 { 00053 unsigned char _M_i; 00054 }; 00055 00056 struct __atomic_short_base 00057 { 00058 short _M_i; 00059 }; 00060 00061 struct __atomic_ushort_base 00062 { 00063 unsigned short _M_i; 00064 }; 00065 00066 struct __atomic_int_base 00067 { 00068 int _M_i; 00069 }; 00070 00071 struct __atomic_uint_base 00072 { 00073 unsigned int _M_i; 00074 }; 00075 00076 struct __atomic_long_base 00077 { 00078 long _M_i; 00079 }; 00080 00081 struct __atomic_ulong_base 00082 { 00083 unsigned long _M_i; 00084 }; 00085 00086 struct __atomic_llong_base 00087 { 00088 long long _M_i; 00089 }; 00090 00091 struct __atomic_ullong_base 00092 { 00093 unsigned long long _M_i; 00094 }; 00095 00096 struct __atomic_wchar_t_base 00097 { 00098 wchar_t _M_i; 00099 }; 00100 00101 typedef struct __atomic_flag_base atomic_flag; 00102 typedef struct __atomic_address_base atomic_address; 00103 typedef struct __atomic_bool_base atomic_bool; 00104 typedef struct __atomic_char_base atomic_char; 00105 typedef struct __atomic_schar_base atomic_schar; 00106 typedef struct __atomic_uchar_base atomic_uchar; 00107 typedef struct __atomic_short_base atomic_short; 00108 typedef struct __atomic_ushort_base atomic_ushort; 00109 typedef struct __atomic_int_base atomic_int; 00110 typedef struct __atomic_uint_base atomic_uint; 00111 typedef struct __atomic_long_base atomic_long; 00112 typedef struct __atomic_ulong_base atomic_ulong; 00113 typedef struct __atomic_llong_base atomic_llong; 00114 typedef struct __atomic_ullong_base atomic_ullong; 00115 typedef struct __atomic_wchar_t_base atomic_wchar_t; 00116 typedef struct __atomic_short_base atomic_char16_t; 00117 typedef struct __atomic_int_base atomic_char32_t; 00118 00119 #define atomic_is_lock_free(__a) \ 00120 false 00121 00122 #define atomic_load_explicit(__a, __x) \ 00123 _ATOMIC_LOAD_(__a, __x) 00124 00125 #define atomic_load(__a) \ 00126 atomic_load_explicit(__a, memory_order_seq_cst) 00127 00128 #define atomic_store_explicit(__a, __m, __x) \ 00129 _ATOMIC_STORE_(__a, __m, __x) 00130 00131 #define atomic_store(__a, __m) \ 00132 atomic_store_explicit(__a, __m, memory_order_seq_cst) 00133 00134 #define atomic_exchange_explicit(__a, __m, __x) \ 00135 _ATOMIC_MODIFY_(__a, =, __m, __x) 00136 00137 #define atomic_exchange(__a, __m) \ 00138 atomic_exchange_explicit(__a, __m, memory_order_seq_cst) 00139 00140 #define atomic_compare_exchange_explicit(__a, __e, __m, __x, __y) \ 00141 _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x) 00142 00143 #define atomic_compare_exchange(__a, __e, __m) \ 00144 _ATOMIC_CMPEXCHNG_(__a, __e, __m, memory_order_seq_cst) 00145 00146 #define atomic_fetch_add_explicit(__a, __m, __x) \ 00147 _ATOMIC_MODIFY_(__a, +=, __m, __x) 00148 00149 #define atomic_fetch_add(__a, __m) \ 00150 atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst) 00151 00152 #define atomic_fetch_sub_explicit(__a, __m, __x) \ 00153 _ATOMIC_MODIFY_(__a, -=, __m, __x) 00154 00155 #define atomic_fetch_sub(__a, __m) \ 00156 atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst) 00157 00158 #define atomic_fetch_and_explicit(__a, __m, __x) \ 00159 _ATOMIC_MODIFY_(__a, &=, __m, __x) 00160 00161 #define atomic_fetch_and(__a, __m) \ 00162 atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst) 00163 00164 #define atomic_fetch_or_explicit(__a, __m, __x) \ 00165 _ATOMIC_MODIFY_(__a, |=, __m, __x) 00166 00167 #define atomic_fetch_or(__a, __m) \ 00168 atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst) 00169 00170 #define atomic_fetch_xor_explicit(__a, __m, __x) \ 00171 _ATOMIC_MODIFY_(__a, ^=, __m, __x) 00172 00173 #define atomic_fetch_xor(__a, __m) \ 00174 atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst)