diff options
Diffstat (limited to '')
-rw-r--r-- | src/common/thread_queue_list.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index 12455d7c4..edd0e4a3f 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h @@ -6,12 +6,11 @@ #include <array> #include <deque> - #include <boost/range/algorithm_ext/erase.hpp> namespace Common { -template<class T, unsigned int N> +template <class T, unsigned int N> struct ThreadQueueList { // TODO(yuriks): If performance proves to be a problem, the std::deques can be replaced with // (dynamically resizable) circular buffers to remove their overhead when @@ -39,7 +38,7 @@ struct ThreadQueueList { } T get_first() { - Queue *cur = first; + Queue* cur = first; while (cur != nullptr) { if (!cur->data.empty()) { return cur->data.front(); @@ -51,7 +50,7 @@ struct ThreadQueueList { } T pop_first() { - Queue *cur = first; + Queue* cur = first; while (cur != nullptr) { if (!cur->data.empty()) { auto tmp = std::move(cur->data.front()); @@ -65,8 +64,8 @@ struct ThreadQueueList { } T pop_first_better(Priority priority) { - Queue *cur = first; - Queue *stop = &queues[priority]; + Queue* cur = first; + Queue* stop = &queues[priority]; while (cur < stop) { if (!cur->data.empty()) { auto tmp = std::move(cur->data.front()); @@ -80,12 +79,12 @@ struct ThreadQueueList { } void push_front(Priority priority, const T& thread_id) { - Queue *cur = &queues[priority]; + Queue* cur = &queues[priority]; cur->data.push_front(thread_id); } void push_back(Priority priority, const T& thread_id) { - Queue *cur = &queues[priority]; + Queue* cur = &queues[priority]; cur->data.push_back(thread_id); } @@ -96,12 +95,12 @@ struct ThreadQueueList { } void remove(Priority priority, const T& thread_id) { - Queue *cur = &queues[priority]; + Queue* cur = &queues[priority]; boost::remove_erase(cur->data, thread_id); } void rotate(Priority priority) { - Queue *cur = &queues[priority]; + Queue* cur = &queues[priority]; if (cur->data.size() > 1) { cur->data.push_back(std::move(cur->data.front())); @@ -115,7 +114,7 @@ struct ThreadQueueList { } bool empty(Priority priority) const { - const Queue *cur = &queues[priority]; + const Queue* cur = &queues[priority]; return cur->data.empty(); } @@ -139,7 +138,7 @@ private: } void link(Priority priority) { - Queue *cur = &queues[priority]; + Queue* cur = &queues[priority]; for (int i = priority - 1; i >= 0; --i) { if (queues[i].next_nonempty != UnlinkedTag()) { |