model: remove useless return code from add_thread()
authorBrian Norris <banorris@uci.edu>
Fri, 10 Aug 2012 21:51:27 +0000 (14:51 -0700)
committerBrian Norris <banorris@uci.edu>
Thu, 16 Aug 2012 17:30:25 +0000 (10:30 -0700)
libthreads.cc
model.cc
model.h

index 28982582eb15fadf2e3f4d5a5152ca0e26489ef3..98df4248fd83749ac9d7c36b7cbb14a3473a2710 100644 (file)
 int thrd_create(thrd_t *t, thrd_start_t start_routine, void *arg)
 {
        Thread *thread;
 int thrd_create(thrd_t *t, thrd_start_t start_routine, void *arg)
 {
        Thread *thread;
-       int ret;
        DBG();
        thread = new Thread(t, start_routine, arg);
        DBG();
        thread = new Thread(t, start_routine, arg);
-       ret = model->add_thread(thread);
+       model->add_thread(thread);
        DEBUG("create thread %d\n", id_to_int(thrd_to_id(*t)));
        /* seq_cst is just a 'don't care' parameter */
        model->switch_to_master(new ModelAction(THREAD_CREATE, std::memory_order_seq_cst, thread, VALUE_NONE));
        DEBUG("create thread %d\n", id_to_int(thrd_to_id(*t)));
        /* seq_cst is just a 'don't care' parameter */
        model->switch_to_master(new ModelAction(THREAD_CREATE, std::memory_order_seq_cst, thread, VALUE_NONE));
-       return ret;
+       return 0;
 }
 
 int thrd_join(thrd_t t)
 }
 
 int thrd_join(thrd_t t)
index 964e83fbd623270628ec1b078b2e9d81c9d136c0..a4f7e90fc332b39c8be422a8eef450f3d4368aca 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -716,11 +716,15 @@ void ModelChecker::print_summary()
        printf("\n");
 }
 
        printf("\n");
 }
 
-int ModelChecker::add_thread(Thread *t)
+/**
+ * Add a Thread to the system for the first time. Should only be called once
+ * per thread.
+ * @param t The Thread to add
+ */
+void ModelChecker::add_thread(Thread *t)
 {
        thread_map->put(id_to_int(t->get_id()), t);
        scheduler->add_thread(t);
 {
        thread_map->put(id_to_int(t->get_id()), t);
        scheduler->add_thread(t);
-       return 0;
 }
 
 void ModelChecker::remove_thread(Thread *t)
 }
 
 void ModelChecker::remove_thread(Thread *t)
diff --git a/model.h b/model.h
index 86e0b1e7b05a8174a05d8a3f28dc7132432962d5..723ca43fe3a4f76a667d3ca921f07ea76fdf6f5b 100644 (file)
--- a/model.h
+++ b/model.h
@@ -52,7 +52,7 @@ public:
 
        Thread * schedule_next_thread();
 
 
        Thread * schedule_next_thread();
 
-       int add_thread(Thread *t);
+       void add_thread(Thread *t);
        void remove_thread(Thread *t);
        Thread * get_thread(thread_id_t tid) { return thread_map->get(id_to_int(tid)); }
 
        void remove_thread(Thread *t);
        Thread * get_thread(thread_id_t tid) { return thread_map->get(id_to_int(tid)); }