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="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.llvm.org/mailman/listinfo/cfe-dev">cfe-dev</a> 26 <a href="http://lists.llvm.org/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><atomic> design</h1> 36 <!--*********************************************************************--> 37 38 <p> 39 There are currently 3 designs under consideration. They differ in where most 40 of the implementation work is done. The functionality exposed to the customer 41 should be identical (and conforming) for all three designs. 42 </p> 43 44 <ol type="A"> 45 <li> 46 <a href="atomic_design_a.html">Minimal work for the library</a> 47 </li> 48 <li> 49 <a href="atomic_design_b.html">Something in between</a> 50 </li> 51 <li> 52 <a href="atomic_design_c.html">Minimal work for the front end</a> 53 </li> 54 </ol> 55 56 <p> 57 With any design, the (back end) compiler writer should note: 58 </p> 59 60 <blockquote> 61 <p> 62 The decision to implement lock-free operations on any given type (or not) is an 63 ABI-binding decision. One can not change from treating a type as not lock free, 64 to lock free (or vice-versa) without breaking your ABI. 65 </p> 66 67 <p> 68 Example: 69 </p> 70 71 <blockquote><pre> 72 TU1.cc 73 ----------- 74 extern atomic<long long> A; 75 int foo() { return A.compare_exchange_strong(w, x); } 76 77 TU2.cc 78 ----------- 79 extern atomic<long long> A; 80 void bar() { return A.compare_exchange_strong(y, z); } 81 </pre></blockquote> 82 </blockquote> 83 84 <p> 85 If only <em>one</em> of these calls to <tt>compare_exchange_strong</tt> is 86 implemented with mutex-locked code, then that mutex-locked code will not be 87 executed mutually exclusively of the one implemented in a lock-free manner. 88 </p> 89 90 </div> 91 </body> 92 </html> 93