while working on memory pool for task records, fixed bug where mem Q hashtable entrie...
[IRC.git] / Robust / src / Runtime / mlp_lock.h
index 0550a9c30a18943faab2acb39c4860314bca67bc..3eb341ea27fafa68e0b2dc1b94ccf81d193ce2dc 100644 (file)
@@ -30,6 +30,10 @@ static inline void atomic_inc(volatile int *v) {
                         : "+m" (*v));
 }
 
+// this returns TRUE if the atomic subtraction results in
+// a zero value--this way two threads cannot dec a value
+// atomically, but then go ahead and both read zero,
+// thinking they both are the last decrementer
 static inline int atomic_sub_and_test(int i, volatile int *v) {
   unsigned char c;