fix rcu
authorPeizhao Ou <peizhaoo@uci.edu>
Sun, 23 Mar 2014 22:17:46 +0000 (15:17 -0700)
committerPeizhao Ou <peizhaoo@uci.edu>
Sun, 23 Mar 2014 22:17:46 +0000 (15:17 -0700)
benchmark/read-copy-update/rcu.cc

index 3d6792f..e0edc4e 100644 (file)
@@ -56,7 +56,7 @@ atomic<Data*> data;
 */
 Data* read() {
        Data *res = data.load(memory_order_acquire);
 */
 Data* read() {
        Data *res = data.load(memory_order_acquire);
-       load_32(&res->data1);
+       //load_32(&res->data1);
        /**
                @Begin
                @Commit_point_define_check: true
        /**
                @Begin
                @Commit_point_define_check: true
@@ -78,16 +78,16 @@ Data* read() {
        @End
 */
 Data* write(int d1, int d2, int d3) {
        @End
 */
 Data* write(int d1, int d2, int d3) {
-       Data *prev = data.load(memory_order_acquire);
        bool succ = false;
        Data *tmp = (Data*) malloc(sizeof(Data));
        do {
        bool succ = false;
        Data *tmp = (Data*) malloc(sizeof(Data));
        do {
-        store_32(&tmp->data1, prev->data1 + d1);
-        //tmp->data1 = prev->data1 + d1;
+               Data *prev = data.load(memory_order_acquire);
+        //store_32(&tmp->data1, prev->data1 + d1);
+        tmp->data1 = prev->data1 + d1;
            tmp->data2 = prev->data2 + d2;
            tmp->data3 = prev->data3 + d3;
         succ = data.compare_exchange_strong(prev, tmp,
            tmp->data2 = prev->data2 + d2;
            tmp->data3 = prev->data3 + d3;
         succ = data.compare_exchange_strong(prev, tmp,
-            memory_order_acq_rel, memory_order_acquire);
+            memory_order_acq_rel, memory_order_relaxed);
                /**
                        @Begin
                        @Commit_point_define_check: succ
                /**
                        @Begin
                        @Commit_point_define_check: succ