rename threads.h -> threads-model.h
[c11tester.git] / model.cc
index e11dcf716939e1a13f1dd08f6b252ab60fef1b9b..5753c5c4e016e2a6b7433aeee60706e777505860 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -12,7 +12,7 @@
 #include "promise.h"
 #include "datarace.h"
 #include "mutex.h"
-#include "threads.h"
+#include "threads-model.h"
 
 #define INITIAL_THREAD_ID      0
 
@@ -1779,6 +1779,11 @@ void ModelChecker::mo_check_promises(thread_id_t tid, const ModelAction *write)
                        //do we have a pwrite for the promise, if not, set it
                        if (promise->get_write() == NULL ) {
                                promise->set_write(write);
+                               //The pwrite cannot happen before the promise
+                               if (write->happens_before(act) && (write != act)) {
+                                       failed_promise = true;
+                                       return;
+                               }
                        }
                        if (mo_graph->checkPromise(write, promise)) {
                                failed_promise = true;