threads: don't make direct call into scheduler
authorBrian Norris <banorris@uci.edu>
Tue, 24 Apr 2012 02:46:30 +0000 (19:46 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 24 Apr 2012 03:08:00 +0000 (20:08 -0700)
Since I need a ModelChecker::add_thread(Thread *) function anyway, I should
direct add_thread() calls through the model-checker framework rather than the
Scheduler class. This will make things a little cleaner and symmetric when I
add a remove_thread() function.

model.cc
threads.cc

index 1f13de7f1e5ac4c74cea012bc096f0a23d666cfe..f50b0f9a60777557429c33ab7fc4b3236ef1cb6f 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -201,6 +201,7 @@ void ModelChecker::print_trace(void)
 int ModelChecker::add_thread(Thread *t)
 {
        thread_map[t->get_id()] = t;
+       scheduler->add_thread(t);
        return 0;
 }
 
index 4c7ac41f1849d2a18fa6ad4510df118f2d81f87d..3af74966469afe1a6897802de9e27c434adf4e76 100644 (file)
@@ -75,7 +75,6 @@ Thread::Thread(thrd_t *t, void (*func)(), void *a) {
        state = THREAD_CREATED;
        id = model->get_next_id();
        *user_thread = id;
-       model->scheduler->add_thread(this);
 }
 
 Thread::Thread(thrd_t *t) {