various fixes. linux rw locks should work again with -m 1
[model-checker.git] / promise.cc
index cbd45c2..59fb9ee 100644 (file)
@@ -13,9 +13,22 @@ bool Promise::increment_threads(thread_id_t tid) {
        synced_thread[id]=true;
        enabled_type_t * enabled=model->get_scheduler()->get_enabled();
        unsigned int sync_size=synced_thread.size();
-       for(unsigned int i=0;i<model->get_num_threads();i++) {
-               if ((i >= sync_size || !synced_thread[i]) && (enabled[i] != THREAD_DISABLED))
+       int promise_tid=id_to_int(read->get_tid());
+       for(unsigned int i=1;i<model->get_num_threads();i++) {
+               if ((i >= sync_size || !synced_thread[i]) && ( i != promise_tid ) && (enabled[i] != THREAD_DISABLED)) {
                        return false;
+               }
+       }
+       return true;
+}
+
+bool Promise::check_promise() {
+       enabled_type_t * enabled=model->get_scheduler()->get_enabled();
+       unsigned int sync_size=synced_thread.size();
+       for(unsigned int i=1;i<model->get_num_threads();i++) {
+               if ((i >= sync_size || !synced_thread[i]) && (enabled[i] != THREAD_DISABLED)) {
+                       return false;
+               }
        }
        return true;
 }