merge in master
[model-checker.git] / action.cc
index 1e28264fbcedf171c673bace33be6f41c3aa3f35..bf55d0091a2fdb368f5a2caf9727c3f2aab61d6f 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -27,6 +27,14 @@ ModelAction::~ModelAction()
                delete cv;
 }
 
+bool ModelAction::is_success_lock() const {
+       return type == ATOMIC_LOCK || (type == ATOMIC_TRYLOCK && value == VALUE_TRYSUCCESS);
+}
+
+bool ModelAction::is_failed_trylock() const {
+       return (type == ATOMIC_TRYLOCK && value == VALUE_TRYFAILED);
+}
+
 bool ModelAction::is_read() const
 {
        return type == ATOMIC_READ || type == ATOMIC_RMWR || type == ATOMIC_RMW;
@@ -173,7 +181,7 @@ void ModelAction::read_from(const ModelAction *act)
        ASSERT(cv);
        reads_from = act;
        if (act != NULL && this->is_acquire()) {
-               std::vector< const ModelAction *, MyAlloc<const ModelAction *> > release_heads;
+               rel_heads_list_t 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]);
@@ -186,7 +194,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);
+       ASSERT(*act < *this || type == THREAD_JOIN);
        model->check_promises(cv, act->cv);
        cv->merge(act->cv);
 }