reverted queue

This commit is contained in:
Johannes Wendel
2019-11-28 23:07:15 +01:00
parent 07536fe1c3
commit b49bfc65f0

View File

@@ -2,7 +2,7 @@
* BlockingQueue.hpp
*
* Created on: May 17, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
*/
#ifndef SRC_UTILITIES_BLOCKINGQUEUE_HPP_
@@ -25,7 +25,7 @@ template<typename T>
class BlockingQueue : public IBlockingQueue<T>
{
private:
std::mutex write_mutex, read_mutex;
std::mutex d_mutex;
std::condition_variable d_condition;
heap::priority_queue<T, heap::stable<true>> p_queue;
@@ -33,7 +33,7 @@ public:
void push(T const &value)
{
{
std::unique_lock<std::mutex> lock(this->write_mutex);
std::unique_lock<std::mutex> lock(this->d_mutex);
p_queue.push(value);
}
this->d_condition.notify_one();
@@ -41,7 +41,7 @@ public:
T pop()
{
std::unique_lock<std::mutex> lock(this->read_mutex);
std::unique_lock<std::mutex> lock(this->d_mutex);
this->d_condition.wait(lock, [=]
{ return !this->p_queue.empty(); });
T rc = *this->p_queue.begin();