diff --git a/FlippR-Driver/src/utilities/BlockingQueue.hpp b/FlippR-Driver/src/utilities/BlockingQueue.hpp deleted file mode 100644 index b1e683d..0000000 --- a/FlippR-Driver/src/utilities/BlockingQueue.hpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * BlockingQueue.hpp - * - * Created on: May 17, 2018 - * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht - */ - -#ifndef SRC_UTILITIES_BLOCKINGQUEUE_HPP_ -#define SRC_UTILITIES_BLOCKINGQUEUE_HPP_ - -#include -#include -#include -#include - -#include "IBlockingQueue.h" - -using namespace boost; - -template -class BlockingQueue : public IBlockingQueue -{ -private: - std::mutex mutex; - std::condition_variable wait_condition; - - heap::priority_queue> p_queue; - -public: - void push(T const& value) - { -<<<<<<< HEAD - std::lock_guard lock(this->mutex); -======= -<<<<<<< HEAD - { - std::unique_lock lock(this->d_mutex); - p_queue.push(value); - } - this->d_condition.notify_one(); -======= - this->promise.set_value(value); - return; ->>>>>>> 3e086976076bbe7c104001de6366eff270d039fb - } - p_queue.push(value); -} ->>>>>>> a8eddc165087dba2da234c0f3cbe38dd185c26d7 - - p_queue.push(value); - -<<<<<<< HEAD - wait_condition.notify_one(); -======= - auto status = future_pop.wait_for(std::chrono::seconds(0)); - if(status == std::future_status::ready) - { -<<<<<<< HEAD - // TODO die queue funzt net weil wir nich pushen koennen wenn wir im pop warten - // TODO denk ma ueber future nach - std::unique_lock lock(this->d_mutex); - this->d_condition.wait(lock, [=]{ return !this->p_queue.empty(); }); - T rc = *this->p_queue.begin(); - this->p_queue.pop(); - return rc; -======= - return future_pop.get(); ->>>>>>> 3e086976076bbe7c104001de6366eff270d039fb ->>>>>>> a8eddc165087dba2da234c0f3cbe38dd185c26d7 - } - - T pop() - { - std::unique_lock lock(this->mutex); - while(this->p_queue.empty()) - { - wait_condition.wait(lock); - } - - auto element = p_queue.top(); - p_queue.pop(); - return element; - } -}; - - - -#endif /* SRC_UTILITIES_BLOCKINGQUEUE_HPP_ */ diff --git a/FlippR-Driver/tests/input/TestEventNotifier.cpp b/FlippR-Driver/tests/input/TestEventNotifier.cpp index 5ebd61d..7066a0d 100644 --- a/FlippR-Driver/tests/input/TestEventNotifier.cpp +++ b/FlippR-Driver/tests/input/TestEventNotifier.cpp @@ -59,8 +59,12 @@ SCENARIO("An EventHandler gets [un]registered at the notifier", "[un-register no THEN("The EventHandler gets saved") { +<<<<<<< HEAD REQUIRE(*(notifier.event_handlers.find(&event_handler_mock.get())) == &event_handler_mock.get()); REQUIRE_FALSE(notifier.event_handlers.empty() ); +======= + REQUIRE(*notifier.event_handler.begin() == &event_handler_mock.get()); +>>>>>>> ddb6d445dd3d61956203a4864797d0b4d17cd277 } }