[cfe-commits] [libcxx] r116065 - in /libcxx/trunk/www: atomic_design.html atomic_design_a.html atomic_design_b.html

Howard Hinnant hhinnant at apple.com
Fri Oct 8 10:36:50 PDT 2010


Author: hhinnant
Date: Fri Oct  8 12:36:50 2010
New Revision: 116065

URL: http://llvm.org/viewvc/llvm-project?rev=116065&view=rev
Log:
Updated atomic design docs

Modified:
    libcxx/trunk/www/atomic_design.html
    libcxx/trunk/www/atomic_design_a.html
    libcxx/trunk/www/atomic_design_b.html

Modified: libcxx/trunk/www/atomic_design.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/atomic_design.html?rev=116065&r1=116064&r2=116065&view=diff
==============================================================================
--- libcxx/trunk/www/atomic_design.html (original)
+++ libcxx/trunk/www/atomic_design.html Fri Oct  8 12:36:50 2010
@@ -53,6 +53,40 @@
 </li>
 </ol>
 
+<p>
+With any design, the (back end) compiler writer should note:
+</p>
+
+<blockquote>
+<p>
+The decision to implement lock-free operations on any given type (or not) is an
+ABI-binding decision.  One can not change from treating a type as not lock free,
+to lock free (or vice-versa) without breaking your ABI.
+</p>
+
+<p>
+Example:
+</p>
+
+<blockquote><pre>
+TU1.cc
+-----------
+extern atomic<long long> A;
+int foo() { return A.compare_exchange_strong(w, x); }
+
+TU2.cc
+-----------
+extern atomic<long long> A;
+void bar() { return A.compare_exchange_strong(y, z); }
+</pre></blockquote>
+</blockquote>
+
+<p>
+If only <em>one</em> of these calls to <tt>compare_exchange_strong</tt> is
+implemented with mutex-locked code, then that mutex-locked code will not be
+executed mutually exclusively of the one implemented in a lock-free manner.
+</p>
+
 </div>
 </body>
 </html>

Modified: libcxx/trunk/www/atomic_design_a.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/atomic_design_a.html?rev=116065&r1=116064&r2=116065&view=diff
==============================================================================
--- libcxx/trunk/www/atomic_design_a.html (original)
+++ libcxx/trunk/www/atomic_design_a.html Fri Oct  8 12:36:50 2010
@@ -50,6 +50,9 @@
 <font color="#C80000">//    volatile-qualifed type.</font>
 
 <font color="#C80000">// type must be trivially copyable</font>
+bool __atomic_is_lock_free(const type* atomic_obj);
+
+<font color="#C80000">// type must be trivially copyable</font>
 <font color="#C80000">// Behavior is defined for mem_ord = 0, 1, 2, 5</font>
 type __atomic_load(const type* atomic_obj, int mem_ord);
 

Modified: libcxx/trunk/www/atomic_design_b.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/atomic_design_b.html?rev=116065&r1=116064&r2=116065&view=diff
==============================================================================
--- libcxx/trunk/www/atomic_design_b.html (original)
+++ libcxx/trunk/www/atomic_design_b.html Fri Oct  8 12:36:50 2010
@@ -44,18 +44,21 @@
 </p>
 
 <blockquote><pre>
-<font color="#C80000">// type can be any pod</font>
+<font color="#C80000">// type must be trivially copyable</font>
+bool __atomic_is_lock_free(const type* atomic_obj);
+
+<font color="#C80000">// type must be trivially copyable</font>
 type __atomic_load_relaxed(const volatile type* atomic_obj);
 type __atomic_load_consume(const volatile type* atomic_obj);
 type __atomic_load_acquire(const volatile type* atomic_obj);
 type __atomic_load_seq_cst(const volatile type* atomic_obj);
 
-<font color="#C80000">// type can be any pod</font>
+<font color="#C80000">// type must be trivially copyable</font>
 type __atomic_store_relaxed(volatile type* atomic_obj, type desired);
 type __atomic_store_release(volatile type* atomic_obj, type desired);
 type __atomic_store_seq_cst(volatile type* atomic_obj, type desired);
 
-<font color="#C80000">// type can be any pod</font>
+<font color="#C80000">// type must be trivially copyable</font>
 type __atomic_exchange_relaxed(volatile type* atomic_obj, type desired);
 type __atomic_exchange_consume(volatile type* atomic_obj, type desired);
 type __atomic_exchange_acquire(volatile type* atomic_obj, type desired);
@@ -63,7 +66,7 @@
 type __atomic_exchange_acq_rel(volatile type* atomic_obj, type desired);
 type __atomic_exchange_seq_cst(volatile type* atomic_obj, type desired);
 
-<font color="#C80000">// type can be any pod</font>
+<font color="#C80000">// type must be trivially copyable</font>
 bool __atomic_compare_exchange_strong_relaxed_relaxed(volatile type* atomic_obj,
                                                       type* expected,
                                                       type desired);
@@ -113,7 +116,7 @@
                                                       type* expected,
                                                       type desired);
 
-<font color="#C80000">// type can be any pod</font>
+<font color="#C80000">// type must be trivially copyable</font>
 bool __atomic_compare_exchange_weak_relaxed_relaxed(volatile type* atomic_obj,
                                                     type* expected,
                                                     type desired);





More information about the cfe-commits mailing list