From: Michal Jarzabek Date: Tue, 25 Nov 2014 20:58:04 +0000 (+0000) Subject: added some consts X-Git-Tag: v0.90~41^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e6410ebf394a8b084d7d18a0a041e9c2ef7daecd;p=ceph.git added some consts Signed-off-by: Michal Jarzabek --- diff --git a/src/common/Thread.cc b/src/common/Thread.cc index a962e06f66a4d..584e97bbd8247 100644 --- a/src/common/Thread.cc +++ b/src/common/Thread.cc @@ -66,7 +66,7 @@ const pthread_t &Thread::get_thread_id() return thread_id; } -bool Thread::is_started() +bool Thread::is_started() const { return thread_id != 0; } diff --git a/src/common/Thread.h b/src/common/Thread.h index 8c0b745149269..7889c91345677 100644 --- a/src/common/Thread.h +++ b/src/common/Thread.h @@ -43,7 +43,7 @@ class Thread { public: const pthread_t &get_thread_id(); pid_t get_pid() const { return pid; } - bool is_started(); + bool is_started() const; bool am_self(); int kill(int signal); int try_create(size_t stacksize); diff --git a/src/msg/simple/DispatchQueue.cc b/src/msg/simple/DispatchQueue.cc index 12c48465ed3f6..c47ee72b81848 100644 --- a/src/msg/simple/DispatchQueue.cc +++ b/src/msg/simple/DispatchQueue.cc @@ -28,7 +28,7 @@ #undef dout_prefix #define dout_prefix *_dout << "-- " << msgr->get_myaddr() << " " -double DispatchQueue::get_max_age(utime_t now) { +double DispatchQueue::get_max_age(utime_t now) const { Mutex::Locker l(lock); if (marrival.empty()) return 0; @@ -60,7 +60,7 @@ void DispatchQueue::post_dispatch(Message *m, uint64_t msize) ldout(cct,20) << "done calling dispatch on " << m << dendl; } -bool DispatchQueue::can_fast_dispatch(Message *m) +bool DispatchQueue::can_fast_dispatch(Message *m) const { return msgr->ms_can_fast_dispatch(m); } diff --git a/src/msg/simple/DispatchQueue.h b/src/msg/simple/DispatchQueue.h index a7e6a37037e02..21997cd054705 100644 --- a/src/msg/simple/DispatchQueue.h +++ b/src/msg/simple/DispatchQueue.h @@ -49,15 +49,15 @@ class DispatchQueue { bool is_code() const { return type != -1; } - int get_code () { + int get_code () const { assert(is_code()); return type; } - Message *get_message() { + Message *get_message() const { assert(!is_code()); return m.get(); } - Connection *get_connection() { + Connection *get_connection() const { assert(is_code()); return con.get(); } @@ -65,7 +65,7 @@ class DispatchQueue { CephContext *cct; SimpleMessenger *msgr; - Mutex lock; + mutable Mutex lock; Cond cond; PrioritizedQueue mqueue; @@ -127,9 +127,9 @@ class DispatchQueue { void local_delivery(Message *m, int priority); void run_local_delivery(); - double get_max_age(utime_t now); + double get_max_age(utime_t now) const; - int get_queue_len() { + int get_queue_len() const { Mutex::Locker l(lock); return mqueue.length(); } @@ -175,7 +175,7 @@ class DispatchQueue { cond.Signal(); } - bool can_fast_dispatch(Message *m); + bool can_fast_dispatch(Message *m) const; void fast_dispatch(Message *m); void fast_preprocess(Message *m); void enqueue(Message *m, int priority, uint64_t id); @@ -188,11 +188,11 @@ class DispatchQueue { void entry(); void wait(); void shutdown(); - bool is_started() {return dispatch_thread.is_started();} + bool is_started() const {return dispatch_thread.is_started();} DispatchQueue(CephContext *cct, SimpleMessenger *msgr) : cct(cct), msgr(msgr), - lock("SimpleMessenger::DispatchQeueu::lock"), + lock("SimpleMessenger::DispatchQueue::lock"), mqueue(cct->_conf->ms_pq_max_tokens_per_priority, cct->_conf->ms_pq_min_cost), next_pipe_id(1),