From: Brian Norris Date: Tue, 24 Apr 2012 00:12:01 +0000 (-0700) Subject: threads: prepare system to loop over many executions X-Git-Tag: pldi2013~520 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e57dd436704ed24dc97c7fea2fbb59e26ae90ec2;p=model-checker.git threads: prepare system to loop over many executions --- diff --git a/model.cc b/model.cc index 773d723..afe159e 100644 --- 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 2a4082b..ccaeda2 100644 --- 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; diff --git a/threads.cc b/threads.cc index 13be391..830ea1a 100644 --- a/threads.cc +++ b/threads.cc @@ -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;