changed BlockingQueue code style

This commit is contained in:
Neeflix
2018-05-31 20:52:08 +02:00
parent 89a6e04dfa
commit 8e742662a7

View File

@@ -23,21 +23,21 @@ private:
heap::priority_queue<T, heap::stable<T>> p_queue;
public:
void push(T const& value) {
{
std::unique_lock<std::mutex> lock(this->d_mutex);
p_queue.push_front(value);
}
this->d_condition.notify_one();
}
void push(T const& value)
{
std::unique_lock<std::mutex> lock(this->d_mutex);
p_queue.push_front(value);
this->d_condition.notify_one();
}
T pop() {
std::unique_lock<std::mutex> lock(this->d_mutex);
this->d_condition.wait(lock, [=]{ return !this->p_queue.empty(); });
T rc(std::move(this->p_queue.back()));
this->p_queue.pop_back();
return rc;
}
T pop()
{
std::unique_lock<std::mutex> lock(this->d_mutex);
this->d_condition.wait(lock, [=]{ return !this->p_queue.empty(); });
T rc(std::move(this->p_queue.back()));
this->p_queue.pop_back();
return rc;
}
};