/www/atomic_design_b.html

https://github.com/lygstate/libcxx · HTML · 250 lines · 226 code · 21 blank · 3 comment · 0 complexity · d8d70ea0a517a0ae56f8acdde751b2f0 MD5 · raw file

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