summaryrefslogtreecommitdiff
path: root/src/common/thread_queue_list.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-08-12 22:13:14 -0400
committerGitHub <noreply@github.com>2018-08-12 22:13:14 -0400
commit9608f51cdee2dd1d2bb493b02b109b1b280dfc28 (patch)
tree5b1d179c66eadc53c0ba534680a91ade726d08be /src/common/thread_queue_list.h
parente4ed5bc83610b7538f3a8ea355a3ed2437c87671 (diff)
parente850ff63bc51eb8ca2ec7b15167315ee648a4f73 (diff)
Merge pull request #1036 from lioncash/thread
scheduler: Make HaveReadyThreads() a const member function
Diffstat (limited to 'src/common/thread_queue_list.h')
-rw-r--r--src/common/thread_queue_list.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h
index 38a450d69..133122c5f 100644
--- a/src/common/thread_queue_list.h
+++ b/src/common/thread_queue_list.h
@@ -16,7 +16,7 @@ struct ThreadQueueList {
// (dynamically resizable) circular buffers to remove their overhead when
// inserting and popping.
- typedef unsigned int Priority;
+ using Priority = unsigned int;
// Number of priority levels. (Valid levels are [0..NUM_QUEUES).)
static const Priority NUM_QUEUES = N;
@@ -26,9 +26,9 @@ struct ThreadQueueList {
}
// Only for debugging, returns priority level.
- Priority contains(const T& uid) {
+ Priority contains(const T& uid) const {
for (Priority i = 0; i < NUM_QUEUES; ++i) {
- Queue& cur = queues[i];
+ const Queue& cur = queues[i];
if (std::find(cur.data.cbegin(), cur.data.cend(), uid) != cur.data.cend()) {
return i;
}
@@ -37,8 +37,8 @@ struct ThreadQueueList {
return -1;
}
- T get_first() {
- Queue* cur = first;
+ T get_first() const {
+ const Queue* cur = first;
while (cur != nullptr) {
if (!cur->data.empty()) {
return cur->data.front();