action: make synchronize_with() public
[c11tester.git] / action.cc
index 5c036ef1cf92e8376ffa7958b0c2b3660f3f3d27..b435524d6d4a423405e221724794e8fcfeae4f84 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #define __STDC_FORMAT_MACROS
 #include <inttypes.h>
+#include <vector>
 
 #include "model.h"
 #include "action.h"
@@ -165,10 +166,13 @@ void ModelAction::create_cv(const ModelAction *parent)
 void ModelAction::read_from(const ModelAction *act)
 {
        ASSERT(cv);
-       if (act!=NULL && act->is_release() && this->is_acquire()) {
-               synchronize_with(act);
-       }
        reads_from = act;
+       if (act != NULL && this->is_acquire()) {
+               std::vector<const ModelAction *> release_heads;
+               model->get_release_seq_heads(this, &release_heads);
+               for (unsigned int i = 0; i < release_heads.size(); i++)
+                       synchronize_with(release_heads[i]);
+       }
 }
 
 /**
@@ -177,6 +181,7 @@ void ModelAction::read_from(const ModelAction *act)
  * @param act The ModelAction to synchronize with
  */
 void ModelAction::synchronize_with(const ModelAction *act) {
+       ASSERT(*act < *this);
        model->check_promises(cv, act->cv);
        cv->merge(act->cv);
 }