threads: prepare system to loop over many executions
authorBrian Norris <banorris@uci.edu>
Tue, 24 Apr 2012 00:12:01 +0000 (17:12 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 24 Apr 2012 00:13:45 +0000 (17:13 -0700)
model.cc
model.h
threads.cc

index 773d723e2a6a0db67f1419c0d7276080002bbf11..afe159ec189ad934cac85eafa7920163b296d160 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -93,6 +93,11 @@ thread_id_t ModelChecker::advance_backtracking_state()
        return get_next_replay_thread();
 }
 
+bool ModelChecker::next_execution()
+{
+       return false;
+}
+
 ModelAction *ModelChecker::get_last_conflict(ModelAction *act)
 {
        void *loc = act->get_location();
diff --git a/model.h b/model.h
index 2a4082b1cdf0c79933b0cdb0aab409c5511e99d7..ccaeda21aaa29b9b4ab9919cc3947ebcef9a36fd 100644 (file)
--- a/model.h
+++ b/model.h
@@ -84,6 +84,8 @@ public:
        void assign_id(Thread *t);
 
        int switch_to_master(ModelAction *act);
+
+       bool next_execution();
 private:
        int used_thread_id;
 
index 13be39170f23e85c887a953b1f6bf79b8f8e5077..830ea1a484159c9df61b641994781d30f97cb989 100644 (file)
@@ -138,13 +138,16 @@ int main()
 
        th = new Thread(&main_thread);
 
-       /* Start user program */
-       thrd_create(&user_thread, &user_main, NULL);
+       do {
+               /* Start user program */
+               thrd_create(&user_thread, &user_main, NULL);
 
-       /* Wait for all threads to complete */
-       thread_wait_finish();
+               /* Wait for all threads to complete */
+               thread_wait_finish();
+
+               model->print_trace();
+       } while (model->next_execution());
 
-       model->print_trace();
        delete th;
        delete model;