diff --git a/www/atomic_design_a.html b/www/atomic_design_a.html index bcb26271..d8cc6c61 100644 --- a/www/atomic_design_a.html +++ b/www/atomic_design_a.html @@ -36,21 +36,34 @@
-This is more of a synopsis than a true description. The compiler supplies all -of the intrinsics as described below. This list of intrinsics roughly parallels -the requirements of the C and C++ atomics proposals. The C and C++ library -imlpementations simply drop through to these intrinsics. Anything the platform -does not support in hardware, the compiler arranges for a (compiler-rt) library -call to be made which will do the job with a mutex, and in this case ignoring -the memory ordering parameter. +The compiler supplies all of the intrinsics as described below. This list of +intrinsics roughly parallels the requirements of the C and C++ atomics +proposals. The C and C++ library imlpementations simply drop through to these +intrinsics. Anything the platform does not support in hardware, the compiler +arranges for a (compiler-rt) library call to be made which will do the job with +a mutex, and in this case ignoring the memory ordering parameter (effectively +implementing memory_order_seq_cst). +
+ ++Ultimate efficiency is preferred over run time error checking. Undefined +behavior is acceptable when the inputs do not conform as defined below.
// In every intrinsic signature below, type* atomic_obj may be a pointer to a // volatile-qualifed type. +// Memory ordering values map to the following meanings: +// memory_order_relaxed == 0 +// memory_order_consume == 1 +// memory_order_acquire == 2 +// memory_order_release == 3 +// memory_order_acq_rel == 4 +// memory_order_seq_cst == 5 // type must be trivially copyable -bool __atomic_is_lock_free(const type* atomic_obj); +// type represents a "type argument" +bool __atomic_is_lock_free(type); // type must be trivially copyable // Behavior is defined for mem_ord = 0, 1, 2, 5 @@ -67,6 +80,8 @@ type __atomic_exchange(type* atomic_obj, type desired, int mem_ord); // type must be trivially copyable // Behavior is defined for mem_success = [0 ... 5], // mem_falure <= mem_success +// mem_falure != 3 +// mem_falure != 4 bool __atomic_compare_exchange_strong(type* atomic_obj, type* expected, type desired, int mem_success, int mem_failure); @@ -74,6 +89,8 @@ bool __atomic_compare_exchange_strong(type* atomic_obj, // type must be trivially copyable // Behavior is defined for mem_success = [0 ... 5], // mem_falure <= mem_success +// mem_falure != 3 +// mem_falure != 4 bool __atomic_compare_exchange_weak(type* atomic_obj, type* expected, type desired, int mem_success, int mem_failure); @@ -124,9 +141,25 @@ this argument to 5.If desired the intrinsics taking two ordering parameters can default -mem_success to 5, and mem_failure to mem_success. +mem_success to 5, and mem_failure to +translate_memory_order(mem_success) where +translate_memory_order(mem_success) is defined as:
++int +translate_memory_order(int o) +{ + switch (o) + { + case 4: + return 2; + case 3: + return 0; + } + return o; +} +