added some consts

Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
This commit is contained in:
Michal Jarzabek 2014-11-25 20:58:04 +00:00
parent c5d272c9f2
commit e6410ebf39
4 changed files with 13 additions and 13 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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<QueueItem, uint64_t> 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),