150
|
1 <!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><atomic> 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="https://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="https://lists.llvm.org/mailman/listinfo/cfe-dev">cfe-dev</a>
|
|
26 <a href="https://lists.llvm.org/mailman/listinfo/cfe-commits">cfe-commits</a>
|
|
27 <a href="https://bugs.llvm.org/">Bug Reports</a>
|
|
28 <a href="https://github.com/llvm/llvm-project/tree/master/libcxx/">Browse Sources</a>
|
|
29 </div>
|
|
30 </div>
|
|
31
|
|
32 <div id="content">
|
|
33 <!--*********************************************************************-->
|
|
34 <h1><atomic> design</h1>
|
|
35 <!--*********************************************************************-->
|
|
36
|
|
37 <p>
|
|
38 This is a variation of design A which puts the burden on the library to arrange
|
|
39 for the correct manipulation of the run time memory ordering arguments, and only
|
|
40 calls the compiler for well-defined memory orderings. I think of this design as
|
|
41 the worst of A and C, instead of the best of A and C. But I offer it as an
|
|
42 option in the spirit of completeness.
|
|
43 </p>
|
|
44
|
|
45 <blockquote><pre>
|
|
46 <font color="#C80000">// type must be trivially copyable</font>
|
|
47 bool __atomic_is_lock_free(const type* atomic_obj);
|
|
48
|
|
49 <font color="#C80000">// type must be trivially copyable</font>
|
|
50 type __atomic_load_relaxed(const volatile type* atomic_obj);
|
|
51 type __atomic_load_consume(const volatile type* atomic_obj);
|
|
52 type __atomic_load_acquire(const volatile type* atomic_obj);
|
|
53 type __atomic_load_seq_cst(const volatile type* atomic_obj);
|
|
54
|
|
55 <font color="#C80000">// type must be trivially copyable</font>
|
|
56 type __atomic_store_relaxed(volatile type* atomic_obj, type desired);
|
|
57 type __atomic_store_release(volatile type* atomic_obj, type desired);
|
|
58 type __atomic_store_seq_cst(volatile type* atomic_obj, type desired);
|
|
59
|
|
60 <font color="#C80000">// type must be trivially copyable</font>
|
|
61 type __atomic_exchange_relaxed(volatile type* atomic_obj, type desired);
|
|
62 type __atomic_exchange_consume(volatile type* atomic_obj, type desired);
|
|
63 type __atomic_exchange_acquire(volatile type* atomic_obj, type desired);
|
|
64 type __atomic_exchange_release(volatile type* atomic_obj, type desired);
|
|
65 type __atomic_exchange_acq_rel(volatile type* atomic_obj, type desired);
|
|
66 type __atomic_exchange_seq_cst(volatile type* atomic_obj, type desired);
|
|
67
|
|
68 <font color="#C80000">// type must be trivially copyable</font>
|
|
69 bool __atomic_compare_exchange_strong_relaxed_relaxed(volatile type* atomic_obj,
|
|
70 type* expected,
|
|
71 type desired);
|
|
72 bool __atomic_compare_exchange_strong_consume_relaxed(volatile type* atomic_obj,
|
|
73 type* expected,
|
|
74 type desired);
|
|
75 bool __atomic_compare_exchange_strong_consume_consume(volatile type* atomic_obj,
|
|
76 type* expected,
|
|
77 type desired);
|
|
78 bool __atomic_compare_exchange_strong_acquire_relaxed(volatile type* atomic_obj,
|
|
79 type* expected,
|
|
80 type desired);
|
|
81 bool __atomic_compare_exchange_strong_acquire_consume(volatile type* atomic_obj,
|
|
82 type* expected,
|
|
83 type desired);
|
|
84 bool __atomic_compare_exchange_strong_acquire_acquire(volatile type* atomic_obj,
|
|
85 type* expected,
|
|
86 type desired);
|
|
87 bool __atomic_compare_exchange_strong_release_relaxed(volatile type* atomic_obj,
|
|
88 type* expected,
|
|
89 type desired);
|
|
90 bool __atomic_compare_exchange_strong_release_consume(volatile type* atomic_obj,
|
|
91 type* expected,
|
|
92 type desired);
|
|
93 bool __atomic_compare_exchange_strong_release_acquire(volatile type* atomic_obj,
|
|
94 type* expected,
|
|
95 type desired);
|
|
96 bool __atomic_compare_exchange_strong_acq_rel_relaxed(volatile type* atomic_obj,
|
|
97 type* expected,
|
|
98 type desired);
|
|
99 bool __atomic_compare_exchange_strong_acq_rel_consume(volatile type* atomic_obj,
|
|
100 type* expected,
|
|
101 type desired);
|
|
102 bool __atomic_compare_exchange_strong_acq_rel_acquire(volatile type* atomic_obj,
|
|
103 type* expected,
|
|
104 type desired);
|
|
105 bool __atomic_compare_exchange_strong_seq_cst_relaxed(volatile type* atomic_obj,
|
|
106 type* expected,
|
|
107 type desired);
|
|
108 bool __atomic_compare_exchange_strong_seq_cst_consume(volatile type* atomic_obj,
|
|
109 type* expected,
|
|
110 type desired);
|
|
111 bool __atomic_compare_exchange_strong_seq_cst_acquire(volatile type* atomic_obj,
|
|
112 type* expected,
|
|
113 type desired);
|
|
114 bool __atomic_compare_exchange_strong_seq_cst_seq_cst(volatile type* atomic_obj,
|
|
115 type* expected,
|
|
116 type desired);
|
|
117
|
|
118 <font color="#C80000">// type must be trivially copyable</font>
|
|
119 bool __atomic_compare_exchange_weak_relaxed_relaxed(volatile type* atomic_obj,
|
|
120 type* expected,
|
|
121 type desired);
|
|
122 bool __atomic_compare_exchange_weak_consume_relaxed(volatile type* atomic_obj,
|
|
123 type* expected,
|
|
124 type desired);
|
|
125 bool __atomic_compare_exchange_weak_consume_consume(volatile type* atomic_obj,
|
|
126 type* expected,
|
|
127 type desired);
|
|
128 bool __atomic_compare_exchange_weak_acquire_relaxed(volatile type* atomic_obj,
|
|
129 type* expected,
|
|
130 type desired);
|
|
131 bool __atomic_compare_exchange_weak_acquire_consume(volatile type* atomic_obj,
|
|
132 type* expected,
|
|
133 type desired);
|
|
134 bool __atomic_compare_exchange_weak_acquire_acquire(volatile type* atomic_obj,
|
|
135 type* expected,
|
|
136 type desired);
|
|
137 bool __atomic_compare_exchange_weak_release_relaxed(volatile type* atomic_obj,
|
|
138 type* expected,
|
|
139 type desired);
|
|
140 bool __atomic_compare_exchange_weak_release_consume(volatile type* atomic_obj,
|
|
141 type* expected,
|
|
142 type desired);
|
|
143 bool __atomic_compare_exchange_weak_release_acquire(volatile type* atomic_obj,
|
|
144 type* expected,
|
|
145 type desired);
|
|
146 bool __atomic_compare_exchange_weak_acq_rel_relaxed(volatile type* atomic_obj,
|
|
147 type* expected,
|
|
148 type desired);
|
|
149 bool __atomic_compare_exchange_weak_acq_rel_consume(volatile type* atomic_obj,
|
|
150 type* expected,
|
|
151 type desired);
|
|
152 bool __atomic_compare_exchange_weak_acq_rel_acquire(volatile type* atomic_obj,
|
|
153 type* expected,
|
|
154 type desired);
|
|
155 bool __atomic_compare_exchange_weak_seq_cst_relaxed(volatile type* atomic_obj,
|
|
156 type* expected,
|
|
157 type desired);
|
|
158 bool __atomic_compare_exchange_weak_seq_cst_consume(volatile type* atomic_obj,
|
|
159 type* expected,
|
|
160 type desired);
|
|
161 bool __atomic_compare_exchange_weak_seq_cst_acquire(volatile type* atomic_obj,
|
|
162 type* expected,
|
|
163 type desired);
|
|
164 bool __atomic_compare_exchange_weak_seq_cst_seq_cst(volatile type* atomic_obj,
|
|
165 type* expected,
|
|
166 type desired);
|
|
167
|
|
168 <font color="#C80000">// type is one of: char, signed char, unsigned char, short, unsigned short, int,</font>
|
|
169 <font color="#C80000">// unsigned int, long, unsigned long, long long, unsigned long long,</font>
|
|
170 <font color="#C80000">// char16_t, char32_t, wchar_t</font>
|
|
171 type __atomic_fetch_add_relaxed(volatile type* atomic_obj, type operand);
|
|
172 type __atomic_fetch_add_consume(volatile type* atomic_obj, type operand);
|
|
173 type __atomic_fetch_add_acquire(volatile type* atomic_obj, type operand);
|
|
174 type __atomic_fetch_add_release(volatile type* atomic_obj, type operand);
|
|
175 type __atomic_fetch_add_acq_rel(volatile type* atomic_obj, type operand);
|
|
176 type __atomic_fetch_add_seq_cst(volatile type* atomic_obj, type operand);
|
|
177
|
|
178 <font color="#C80000">// type is one of: char, signed char, unsigned char, short, unsigned short, int,</font>
|
|
179 <font color="#C80000">// unsigned int, long, unsigned long, long long, unsigned long long,</font>
|
|
180 <font color="#C80000">// char16_t, char32_t, wchar_t</font>
|
|
181 type __atomic_fetch_sub_relaxed(volatile type* atomic_obj, type operand);
|
|
182 type __atomic_fetch_sub_consume(volatile type* atomic_obj, type operand);
|
|
183 type __atomic_fetch_sub_acquire(volatile type* atomic_obj, type operand);
|
|
184 type __atomic_fetch_sub_release(volatile type* atomic_obj, type operand);
|
|
185 type __atomic_fetch_sub_acq_rel(volatile type* atomic_obj, type operand);
|
|
186 type __atomic_fetch_sub_seq_cst(volatile type* atomic_obj, type operand);
|
|
187
|
|
188 <font color="#C80000">// type is one of: char, signed char, unsigned char, short, unsigned short, int,</font>
|
|
189 <font color="#C80000">// unsigned int, long, unsigned long, long long, unsigned long long,</font>
|
|
190 <font color="#C80000">// char16_t, char32_t, wchar_t</font>
|
|
191 type __atomic_fetch_and_relaxed(volatile type* atomic_obj, type operand);
|
|
192 type __atomic_fetch_and_consume(volatile type* atomic_obj, type operand);
|
|
193 type __atomic_fetch_and_acquire(volatile type* atomic_obj, type operand);
|
|
194 type __atomic_fetch_and_release(volatile type* atomic_obj, type operand);
|
|
195 type __atomic_fetch_and_acq_rel(volatile type* atomic_obj, type operand);
|
|
196 type __atomic_fetch_and_seq_cst(volatile type* atomic_obj, type operand);
|
|
197
|
|
198 <font color="#C80000">// type is one of: char, signed char, unsigned char, short, unsigned short, int,</font>
|
|
199 <font color="#C80000">// unsigned int, long, unsigned long, long long, unsigned long long,</font>
|
|
200 <font color="#C80000">// char16_t, char32_t, wchar_t</font>
|
|
201 type __atomic_fetch_or_relaxed(volatile type* atomic_obj, type operand);
|
|
202 type __atomic_fetch_or_consume(volatile type* atomic_obj, type operand);
|
|
203 type __atomic_fetch_or_acquire(volatile type* atomic_obj, type operand);
|
|
204 type __atomic_fetch_or_release(volatile type* atomic_obj, type operand);
|
|
205 type __atomic_fetch_or_acq_rel(volatile type* atomic_obj, type operand);
|
|
206 type __atomic_fetch_or_seq_cst(volatile type* atomic_obj, type operand);
|
|
207
|
|
208 <font color="#C80000">// type is one of: char, signed char, unsigned char, short, unsigned short, int,</font>
|
|
209 <font color="#C80000">// unsigned int, long, unsigned long, long long, unsigned long long,</font>
|
|
210 <font color="#C80000">// char16_t, char32_t, wchar_t</font>
|
|
211 type __atomic_fetch_xor_relaxed(volatile type* atomic_obj, type operand);
|
|
212 type __atomic_fetch_xor_consume(volatile type* atomic_obj, type operand);
|
|
213 type __atomic_fetch_xor_acquire(volatile type* atomic_obj, type operand);
|
|
214 type __atomic_fetch_xor_release(volatile type* atomic_obj, type operand);
|
|
215 type __atomic_fetch_xor_acq_rel(volatile type* atomic_obj, type operand);
|
|
216 type __atomic_fetch_xor_seq_cst(volatile type* atomic_obj, type operand);
|
|
217
|
|
218 void* __atomic_fetch_add_relaxed(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
219 void* __atomic_fetch_add_consume(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
220 void* __atomic_fetch_add_acquire(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
221 void* __atomic_fetch_add_release(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
222 void* __atomic_fetch_add_acq_rel(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
223 void* __atomic_fetch_add_seq_cst(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
224
|
|
225 void* __atomic_fetch_sub_relaxed(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
226 void* __atomic_fetch_sub_consume(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
227 void* __atomic_fetch_sub_acquire(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
228 void* __atomic_fetch_sub_release(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
229 void* __atomic_fetch_sub_acq_rel(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
230 void* __atomic_fetch_sub_seq_cst(void* volatile* atomic_obj, ptrdiff_t operand);
|
|
231
|
|
232 void __atomic_thread_fence_relaxed();
|
|
233 void __atomic_thread_fence_consume();
|
|
234 void __atomic_thread_fence_acquire();
|
|
235 void __atomic_thread_fence_release();
|
|
236 void __atomic_thread_fence_acq_rel();
|
|
237 void __atomic_thread_fence_seq_cst();
|
|
238
|
|
239 void __atomic_signal_fence_relaxed();
|
|
240 void __atomic_signal_fence_consume();
|
|
241 void __atomic_signal_fence_acquire();
|
|
242 void __atomic_signal_fence_release();
|
|
243 void __atomic_signal_fence_acq_rel();
|
|
244 void __atomic_signal_fence_seq_cst();
|
|
245 </pre></blockquote>
|
|
246
|
|
247 </div>
|
|
248 </body>
|
|
249 </html>
|