model: privatize some thread functions
authorBrian Norris <banorris@uci.edu>
Sat, 9 Mar 2013 20:24:06 +0000 (12:24 -0800)
committerBrian Norris <banorris@uci.edu>
Sat, 9 Mar 2013 20:24:06 +0000 (12:24 -0800)
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
model.h
threads.cc

index bf602246b5f83be35e924a772a874949dcf0ba56..0cc20794d61f1217163743de2f3147459d5d1466 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -2933,15 +2933,6 @@ void ModelChecker::add_thread(Thread *t)
        scheduler->add_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
 /**
  * @brief Get a Thread reference by its ID
  * @param tid The Thread's ID
diff --git a/model.h b/model.h
index a72e0b50ef8188c49188dee959085f807625dcfa..4b87b04a48a00263b9377c8e3b82549228e329f9 100644 (file)
--- a/model.h
+++ b/model.h
@@ -111,8 +111,6 @@ public:
        void dumpGraph(char *filename) const;
 #endif
 
        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;
        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;
 
        /** 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);
        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);
index f417b3ff353fa3a59a23328c44dfb6b908f4727c..00e5c2fbd4a0f1287ac6b68b8be50a1a49b82bd8 100644 (file)
@@ -180,7 +180,6 @@ Thread::~Thread()
 {
        if (!is_complete())
                complete();
 {
        if (!is_complete())
                complete();
-       model->remove_thread(this);
 }
 
 /** @return The thread_id_t corresponding to this Thread object. */
 }
 
 /** @return The thread_id_t corresponding to this Thread object. */