From a575b5d5d2f0edab95e7e0ef8ca6e40b68e0bad9 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Sat, 9 Mar 2013 12:24:06 -0800 Subject: [PATCH] model: privatize some thread functions We never need to call ModelChecker::add_thread from outside ModelChecker. We really shouldn't try to call 'remove_thread' from the Thread destructor. It's unnecessary. --- model.cc | 9 --------- model.h | 4 ++-- threads.cc | 1 - 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/model.cc b/model.cc index bf60224..0cc2079 100644 --- a/model.cc +++ b/model.cc @@ -2933,15 +2933,6 @@ void ModelChecker::add_thread(Thread *t) scheduler->add_thread(t); } -/** - * Removes a thread from the scheduler. - * @param the thread to remove. - */ -void ModelChecker::remove_thread(Thread *t) -{ - scheduler->remove_thread(t); -} - /** * @brief Get a Thread reference by its ID * @param tid The Thread's ID diff --git a/model.h b/model.h index a72e0b5..4b87b04 100644 --- a/model.h +++ b/model.h @@ -111,8 +111,6 @@ public: void dumpGraph(char *filename) const; #endif - void add_thread(Thread *t); - void remove_thread(Thread *t); Thread * get_thread(thread_id_t tid) const; Thread * get_thread(const ModelAction *act) const; int get_promise_number(const Promise *promise) const; @@ -143,6 +141,8 @@ private: /** The scheduler to use: tracks the running/ready Threads */ Scheduler * const scheduler; + void add_thread(Thread *t); + bool sleep_can_read_from(ModelAction *curr, const ModelAction *write); bool thin_air_constraint_may_allow(const ModelAction *writer, const ModelAction *reader); bool mo_may_allow(const ModelAction *writer, const ModelAction *reader); diff --git a/threads.cc b/threads.cc index f417b3f..00e5c2f 100644 --- a/threads.cc +++ b/threads.cc @@ -180,7 +180,6 @@ Thread::~Thread() { if (!is_complete()) complete(); - model->remove_thread(this); } /** @return The thread_id_t corresponding to this Thread object. */ -- 2.34.1