changes
[model-checker-benchmarks.git] / seqlock / seqlock-wildcard.h
index 62b7583954bd446a4c224030117712321d5ff369..c7d0634e3b5a763fd234f5963f29beba7500f914 100644 (file)
@@ -27,14 +27,14 @@ typedef struct seqlock {
        }
        
        void write(int new_data) {
-               int old_seq = _seq.load(wildcard(4)); // acquire
                while (true) {
+                       int old_seq = _seq.load(wildcard(4)); // acquire
                        if (old_seq % 2 == 1)
                                continue; // Retry
 
                        // Should be relaxed!!! 
                        if (_seq.compare_exchange_strong(old_seq, old_seq + 1,
-                               wildcard(5), wildcard(6))) // relaxed 
+                               wildcard(5), wildcard(6))) // relaxed  
                                break;
                }