From 1f89a2b5691c26417c93d283e73e181bc6cea1a5 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 10 Aug 2012 16:20:15 -0700 Subject: [PATCH] schedule: make print() const Switch to using a "const_iterator" so that the whole function becomes const. --- schedule.cc | 4 ++-- schedule.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/schedule.cc b/schedule.cc index 8f7f1a9..69e3d88 100644 --- a/schedule.cc +++ b/schedule.cc @@ -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 >::iterator it; + std::list >::const_iterator it; for (it = readyList.begin(); it != readyList.end(); it++) DEBUG("In ready list: thread %d\n", (*it)->get_id()); } diff --git a/schedule.h b/schedule.h index 68ef111..c8153b3 100644 --- a/schedule.h +++ b/schedule.h @@ -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: -- 2.34.1