diff options
Diffstat (limited to 'src/common/thread_queue_list.h')
| -rw-r--r-- | src/common/thread_queue_list.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index 12455d7c4..0dcf785b6 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | namespace Common { | 12 | namespace Common { |
| 13 | 13 | ||
| 14 | template<class T, unsigned int N> | 14 | template <class T, unsigned int N> |
| 15 | struct ThreadQueueList { | 15 | struct ThreadQueueList { |
| 16 | // TODO(yuriks): If performance proves to be a problem, the std::deques can be replaced with | 16 | // TODO(yuriks): If performance proves to be a problem, the std::deques can be replaced with |
| 17 | // (dynamically resizable) circular buffers to remove their overhead when | 17 | // (dynamically resizable) circular buffers to remove their overhead when |
| @@ -39,7 +39,7 @@ struct ThreadQueueList { | |||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | T get_first() { | 41 | T get_first() { |
| 42 | Queue *cur = first; | 42 | Queue* cur = first; |
| 43 | while (cur != nullptr) { | 43 | while (cur != nullptr) { |
| 44 | if (!cur->data.empty()) { | 44 | if (!cur->data.empty()) { |
| 45 | return cur->data.front(); | 45 | return cur->data.front(); |
| @@ -51,7 +51,7 @@ struct ThreadQueueList { | |||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | T pop_first() { | 53 | T pop_first() { |
| 54 | Queue *cur = first; | 54 | Queue* cur = first; |
| 55 | while (cur != nullptr) { | 55 | while (cur != nullptr) { |
| 56 | if (!cur->data.empty()) { | 56 | if (!cur->data.empty()) { |
| 57 | auto tmp = std::move(cur->data.front()); | 57 | auto tmp = std::move(cur->data.front()); |
| @@ -65,8 +65,8 @@ struct ThreadQueueList { | |||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | T pop_first_better(Priority priority) { | 67 | T pop_first_better(Priority priority) { |
| 68 | Queue *cur = first; | 68 | Queue* cur = first; |
| 69 | Queue *stop = &queues[priority]; | 69 | Queue* stop = &queues[priority]; |
| 70 | while (cur < stop) { | 70 | while (cur < stop) { |
| 71 | if (!cur->data.empty()) { | 71 | if (!cur->data.empty()) { |
| 72 | auto tmp = std::move(cur->data.front()); | 72 | auto tmp = std::move(cur->data.front()); |
| @@ -80,12 +80,12 @@ struct ThreadQueueList { | |||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | void push_front(Priority priority, const T& thread_id) { | 82 | void push_front(Priority priority, const T& thread_id) { |
| 83 | Queue *cur = &queues[priority]; | 83 | Queue* cur = &queues[priority]; |
| 84 | cur->data.push_front(thread_id); | 84 | cur->data.push_front(thread_id); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | void push_back(Priority priority, const T& thread_id) { | 87 | void push_back(Priority priority, const T& thread_id) { |
| 88 | Queue *cur = &queues[priority]; | 88 | Queue* cur = &queues[priority]; |
| 89 | cur->data.push_back(thread_id); | 89 | cur->data.push_back(thread_id); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| @@ -96,12 +96,12 @@ struct ThreadQueueList { | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | void remove(Priority priority, const T& thread_id) { | 98 | void remove(Priority priority, const T& thread_id) { |
| 99 | Queue *cur = &queues[priority]; | 99 | Queue* cur = &queues[priority]; |
| 100 | boost::remove_erase(cur->data, thread_id); | 100 | boost::remove_erase(cur->data, thread_id); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | void rotate(Priority priority) { | 103 | void rotate(Priority priority) { |
| 104 | Queue *cur = &queues[priority]; | 104 | Queue* cur = &queues[priority]; |
| 105 | 105 | ||
| 106 | if (cur->data.size() > 1) { | 106 | if (cur->data.size() > 1) { |
| 107 | cur->data.push_back(std::move(cur->data.front())); | 107 | cur->data.push_back(std::move(cur->data.front())); |
| @@ -115,7 +115,7 @@ struct ThreadQueueList { | |||
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | bool empty(Priority priority) const { | 117 | bool empty(Priority priority) const { |
| 118 | const Queue *cur = &queues[priority]; | 118 | const Queue* cur = &queues[priority]; |
| 119 | return cur->data.empty(); | 119 | return cur->data.empty(); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| @@ -139,7 +139,7 @@ private: | |||
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | void link(Priority priority) { | 141 | void link(Priority priority) { |
| 142 | Queue *cur = &queues[priority]; | 142 | Queue* cur = &queues[priority]; |
| 143 | 143 | ||
| 144 | for (int i = priority - 1; i >= 0; --i) { | 144 | for (int i = priority - 1; i >= 0; --i) { |
| 145 | if (queues[i].next_nonempty != UnlinkedTag()) { | 145 | if (queues[i].next_nonempty != UnlinkedTag()) { |