From: Brian Norris Date: Sat, 9 Mar 2013 20:24:06 +0000 (-0800) Subject: model: privatize some thread functions X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=a575b5d5d2f0edab95e7e0ef8ca6e40b68e0bad9 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. --- diff --git a/model.cc b/model.cc index bf602246..0cc20794 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 a72e0b50..4b87b04a 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 f417b3ff..00e5c2fb 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. */