schedule: make print() const
authorBrian Norris <banorris@uci.edu>
Fri, 10 Aug 2012 23:20:15 +0000 (16:20 -0700)
committerBrian Norris <banorris@uci.edu>
Thu, 16 Aug 2012 17:30:27 +0000 (10:30 -0700)
Switch to using a "const_iterator" so that the whole function becomes const.

schedule.cc
schedule.h

index 8f7f1a98d8cc2833c812243cecaa284d375286ad..69e3d88803bcc06d15ee2fed115330b1397662f5 100644 (file)
@@ -67,7 +67,7 @@ Thread * Scheduler::get_current_thread() const
  * Print debugging information about the current state of the scheduler. Only
  * prints something if debugging is enabled.
  */
-void Scheduler::print()
+void Scheduler::print() const
 {
        if (current)
                DEBUG("Current thread: %d\n", current->get_id());
@@ -75,7 +75,7 @@ void Scheduler::print()
                DEBUG("No current thread\n");
        DEBUG("Num. threads in ready list: %zu\n", readyList.size());
 
-       std::list<Thread *, MyAlloc< Thread * > >::iterator it;
+       std::list<Thread *, MyAlloc< Thread * > >::const_iterator it;
        for (it = readyList.begin(); it != readyList.end(); it++)
                DEBUG("In ready list: thread %d\n", (*it)->get_id());
 }
index 68ef11106d080afddd6857a322e6d254501554a3..c8153b31821d554940d9faa5d4f1b83dd912f58c 100644 (file)
@@ -20,7 +20,7 @@ public:
        void remove_thread(Thread *t);
        Thread * next_thread();
        Thread * get_current_thread() const;
-       void print();
+       void print() const;
 
        SNAPSHOTALLOC
 private: