fixed rcu
[cdsspec-compiler.git] / benchmark / read-copy-update / rcu.cc
index 75f470b2ee53b5c764d06cb3bb7c887b649957f0..8aad9d19b56be3bfb439156f84e15ff08ec10690 100644 (file)
@@ -6,8 +6,6 @@
 
 #include "librace.h"
 
-using namespace std;
-
 /**
        This is an example about how to specify the correctness of the
        read-copy-update synchronization mechanism.
@@ -31,7 +29,7 @@ atomic<Data*> data;
                
                @DefineFunc:
                bool equals(Data *ptr1, Data *ptr2) {
-                       if (ptr1->data1 == ptr2->data2
+                       if (ptr1->data1 == ptr2->data1
                                && ptr1->data2 == ptr2->data2
                                && ptr1->data3 == ptr2->data3) {
                                return true;
@@ -115,6 +113,7 @@ int user_main(int argc, char **argv) {
        */
        
        thrd_t t1, t2;
+       data.store(NULL, memory_order_relaxed);
        Data *data_init = (Data*) malloc(sizeof(Data));
        data_init->data1 = 1;
        data_init->data2 = 2;