blob: 7891050c132d5dbf3be1b370ef37d0cd7dbdebdc [file] [log] [blame]
Howard Hinnanta35a35f2010-10-06 16:15:10 +00001<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3<!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ -->
4<html>
5<head>
6 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
7 <title>&lt;atomic&gt; design</title>
8 <link type="text/css" rel="stylesheet" href="menu.css">
9 <link type="text/css" rel="stylesheet" href="content.css">
10</head>
11
12<body>
13<div id="menu">
14 <div>
15 <a href="http://llvm.org/">LLVM Home</a>
16 </div>
17
18 <div class="submenu">
19 <label>libc++ Info</label>
20 <a href="/index.html">About</a>
21 </div>
22
23 <div class="submenu">
24 <label>Quick Links</label>
25 <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">cfe-dev</a>
26 <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">cfe-commits</a>
27 <a href="http://llvm.org/bugs/">Bug Reports</a>
28 <a href="http://llvm.org/svn/llvm-project/libcxx/trunk/">Browse SVN</a>
29 <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/">Browse ViewVC</a>
30 </div>
31</div>
32
33<div id="content">
34 <!--*********************************************************************-->
35 <h1>&lt;atomic&gt; design</h1>
36 <!--*********************************************************************-->
37
38<p>
39This is a variation of design A which puts the burden on the library to arrange
40for the correct manipulation of the run time memory ordering arguments, and only
41calls the compiler for well-defined memory orderings. I think of this design as
42the worst of A and C, instead of the best of A and C. But I offer it as an
43option in the spirit of completeness.
44</p>
45
46<blockquote><pre>
47<font color="#C80000">// type can be any pod</font>
48type __atomic_load_relaxed(const volatile type* atomic_obj);
49type __atomic_load_consume(const volatile type* atomic_obj);
50type __atomic_load_acquire(const volatile type* atomic_obj);
51type __atomic_load_seq_cst(const volatile type* atomic_obj);
52
53<font color="#C80000">// type can be any pod</font>
54type __atomic_store_relaxed(volatile type* atomic_obj, type desired);
55type __atomic_store_release(volatile type* atomic_obj, type desired);
56type __atomic_store_seq_cst(volatile type* atomic_obj, type desired);
57
58<font color="#C80000">// type can be any pod</font>
59type __atomic_exchange_relaxed(volatile type* atomic_obj, type desired);
60type __atomic_exchange_consume(volatile type* atomic_obj, type desired);
61type __atomic_exchange_acquire(volatile type* atomic_obj, type desired);
62type __atomic_exchange_release(volatile type* atomic_obj, type desired);
63type __atomic_exchange_acq_rel(volatile type* atomic_obj, type desired);
64type __atomic_exchange_seq_cst(volatile type* atomic_obj, type desired);
65
66<font color="#C80000">// type can be any pod</font>
67bool __atomic_compare_exchange_strong_relaxed_relaxed(volatile type* atomic_obj,
68 type* expected,
69 type desired);
70bool __atomic_compare_exchange_strong_consume_relaxed(volatile type* atomic_obj,
71 type* expected,
72 type desired);
73bool __atomic_compare_exchange_strong_consume_consume(volatile type* atomic_obj,
74 type* expected,
75 type desired);
76bool __atomic_compare_exchange_strong_acquire_relaxed(volatile type* atomic_obj,
77 type* expected,
78 type desired);
79bool __atomic_compare_exchange_strong_acquire_consume(volatile type* atomic_obj,
80 type* expected,
81 type desired);
82bool __atomic_compare_exchange_strong_acquire_acquire(volatile type* atomic_obj,
83 type* expected,
84 type desired);
85bool __atomic_compare_exchange_strong_release_relaxed(volatile type* atomic_obj,
86 type* expected,
87 type desired);
88bool __atomic_compare_exchange_strong_release_consume(volatile type* atomic_obj,
89 type* expected,
90 type desired);
91bool __atomic_compare_exchange_strong_release_acquire(volatile type* atomic_obj,
92 type* expected,
93 type desired);
94bool __atomic_compare_exchange_strong_acq_rel_relaxed(volatile type* atomic_obj,
95 type* expected,
96 type desired);
97bool __atomic_compare_exchange_strong_acq_rel_consume(volatile type* atomic_obj,
98 type* expected,
99 type desired);
100bool __atomic_compare_exchange_strong_acq_rel_acquire(volatile type* atomic_obj,
101 type* expected,
102 type desired);
103bool __atomic_compare_exchange_strong_seq_cst_relaxed(volatile type* atomic_obj,
104 type* expected,
105 type desired);
106bool __atomic_compare_exchange_strong_seq_cst_consume(volatile type* atomic_obj,
107 type* expected,
108 type desired);
109bool __atomic_compare_exchange_strong_seq_cst_acquire(volatile type* atomic_obj,
110 type* expected,
111 type desired);
112bool __atomic_compare_exchange_strong_seq_cst_seq_cst(volatile type* atomic_obj,
113 type* expected,
114 type desired);
115
116<font color="#C80000">// type can be any pod</font>
117bool __atomic_compare_exchange_weak_relaxed_relaxed(volatile type* atomic_obj,
118 type* expected,
119 type desired);
120bool __atomic_compare_exchange_weak_consume_relaxed(volatile type* atomic_obj,
121 type* expected,
122 type desired);
123bool __atomic_compare_exchange_weak_consume_consume(volatile type* atomic_obj,
124 type* expected,
125 type desired);
126bool __atomic_compare_exchange_weak_acquire_relaxed(volatile type* atomic_obj,
127 type* expected,
128 type desired);
129bool __atomic_compare_exchange_weak_acquire_consume(volatile type* atomic_obj,
130 type* expected,
131 type desired);
132bool __atomic_compare_exchange_weak_acquire_acquire(volatile type* atomic_obj,
133 type* expected,
134 type desired);
135bool __atomic_compare_exchange_weak_release_relaxed(volatile type* atomic_obj,
136 type* expected,
137 type desired);
138bool __atomic_compare_exchange_weak_release_consume(volatile type* atomic_obj,
139 type* expected,
140 type desired);
141bool __atomic_compare_exchange_weak_release_acquire(volatile type* atomic_obj,
142 type* expected,
143 type desired);
144bool __atomic_compare_exchange_weak_acq_rel_relaxed(volatile type* atomic_obj,
145 type* expected,
146 type desired);
147bool __atomic_compare_exchange_weak_acq_rel_consume(volatile type* atomic_obj,
148 type* expected,
149 type desired);
150bool __atomic_compare_exchange_weak_acq_rel_acquire(volatile type* atomic_obj,
151 type* expected,
152 type desired);
153bool __atomic_compare_exchange_weak_seq_cst_relaxed(volatile type* atomic_obj,
154 type* expected,
155 type desired);
156bool __atomic_compare_exchange_weak_seq_cst_consume(volatile type* atomic_obj,
157 type* expected,
158 type desired);
159bool __atomic_compare_exchange_weak_seq_cst_acquire(volatile type* atomic_obj,
160 type* expected,
161 type desired);
162bool __atomic_compare_exchange_weak_seq_cst_seq_cst(volatile type* atomic_obj,
163 type* expected,
164 type desired);
165
166<font color="#C80000">// type is one of: char, signed char, unsigned char, short, unsigned short, int,</font>
167<font color="#C80000">// unsigned int, long, unsigned long, long long, unsigned long long,</font>
168<font color="#C80000">// char16_t, char32_t, wchar_t</font>
169type __atomic_fetch_add_relaxed(volatile type* atomic_obj, type operand);
170type __atomic_fetch_add_consume(volatile type* atomic_obj, type operand);
171type __atomic_fetch_add_acquire(volatile type* atomic_obj, type operand);
172type __atomic_fetch_add_release(volatile type* atomic_obj, type operand);
173type __atomic_fetch_add_acq_rel(volatile type* atomic_obj, type operand);
174type __atomic_fetch_add_seq_cst(volatile type* atomic_obj, type operand);
175
176<font color="#C80000">// type is one of: char, signed char, unsigned char, short, unsigned short, int,</font>
177<font color="#C80000">// unsigned int, long, unsigned long, long long, unsigned long long,</font>
178<font color="#C80000">// char16_t, char32_t, wchar_t</font>
179type __atomic_fetch_sub_relaxed(volatile type* atomic_obj, type operand);
180type __atomic_fetch_sub_consume(volatile type* atomic_obj, type operand);
181type __atomic_fetch_sub_acquire(volatile type* atomic_obj, type operand);
182type __atomic_fetch_sub_release(volatile type* atomic_obj, type operand);
183type __atomic_fetch_sub_acq_rel(volatile type* atomic_obj, type operand);
184type __atomic_fetch_sub_seq_cst(volatile type* atomic_obj, type operand);
185
186<font color="#C80000">// type is one of: char, signed char, unsigned char, short, unsigned short, int,</font>
187<font color="#C80000">// unsigned int, long, unsigned long, long long, unsigned long long,</font>
188<font color="#C80000">// char16_t, char32_t, wchar_t</font>
189type __atomic_fetch_and_relaxed(volatile type* atomic_obj, type operand);
190type __atomic_fetch_and_consume(volatile type* atomic_obj, type operand);
191type __atomic_fetch_and_acquire(volatile type* atomic_obj, type operand);
192type __atomic_fetch_and_release(volatile type* atomic_obj, type operand);
193type __atomic_fetch_and_acq_rel(volatile type* atomic_obj, type operand);
194type __atomic_fetch_and_seq_cst(volatile type* atomic_obj, type operand);
195
196<font color="#C80000">// type is one of: char, signed char, unsigned char, short, unsigned short, int,</font>
197<font color="#C80000">// unsigned int, long, unsigned long, long long, unsigned long long,</font>
198<font color="#C80000">// char16_t, char32_t, wchar_t</font>
199type __atomic_fetch_or_relaxed(volatile type* atomic_obj, type operand);
200type __atomic_fetch_or_consume(volatile type* atomic_obj, type operand);
201type __atomic_fetch_or_acquire(volatile type* atomic_obj, type operand);
202type __atomic_fetch_or_release(volatile type* atomic_obj, type operand);
203type __atomic_fetch_or_acq_rel(volatile type* atomic_obj, type operand);
204type __atomic_fetch_or_seq_cst(volatile type* atomic_obj, type operand);
205
206<font color="#C80000">// type is one of: char, signed char, unsigned char, short, unsigned short, int,</font>
207<font color="#C80000">// unsigned int, long, unsigned long, long long, unsigned long long,</font>
208<font color="#C80000">// char16_t, char32_t, wchar_t</font>
209type __atomic_fetch_xor_relaxed(volatile type* atomic_obj, type operand);
210type __atomic_fetch_xor_consume(volatile type* atomic_obj, type operand);
211type __atomic_fetch_xor_acquire(volatile type* atomic_obj, type operand);
212type __atomic_fetch_xor_release(volatile type* atomic_obj, type operand);
213type __atomic_fetch_xor_acq_rel(volatile type* atomic_obj, type operand);
214type __atomic_fetch_xor_seq_cst(volatile type* atomic_obj, type operand);
215
216void* __atomic_fetch_add_relaxed(void* volatile* atomic_obj, ptrdiff_t operand);
217void* __atomic_fetch_add_consume(void* volatile* atomic_obj, ptrdiff_t operand);
218void* __atomic_fetch_add_acquire(void* volatile* atomic_obj, ptrdiff_t operand);
219void* __atomic_fetch_add_release(void* volatile* atomic_obj, ptrdiff_t operand);
220void* __atomic_fetch_add_acq_rel(void* volatile* atomic_obj, ptrdiff_t operand);
221void* __atomic_fetch_add_seq_cst(void* volatile* atomic_obj, ptrdiff_t operand);
222
223void* __atomic_fetch_sub_relaxed(void* volatile* atomic_obj, ptrdiff_t operand);
224void* __atomic_fetch_sub_consume(void* volatile* atomic_obj, ptrdiff_t operand);
225void* __atomic_fetch_sub_acquire(void* volatile* atomic_obj, ptrdiff_t operand);
226void* __atomic_fetch_sub_release(void* volatile* atomic_obj, ptrdiff_t operand);
227void* __atomic_fetch_sub_acq_rel(void* volatile* atomic_obj, ptrdiff_t operand);
228void* __atomic_fetch_sub_seq_cst(void* volatile* atomic_obj, ptrdiff_t operand);
229
230void __atomic_thread_fence_relaxed();
231void __atomic_thread_fence_consume();
232void __atomic_thread_fence_acquire();
233void __atomic_thread_fence_release();
234void __atomic_thread_fence_acq_rel();
235void __atomic_thread_fence_seq_cst();
236
237void __atomic_signal_fence_relaxed();
238void __atomic_signal_fence_consume();
239void __atomic_signal_fence_acquire();
240void __atomic_signal_fence_release();
241void __atomic_signal_fence_acq_rel();
242void __atomic_signal_fence_seq_cst();
243</pre></blockquote>
244
245</div>
246</body>
247</html>