Commit ecd1ecdf by lucapegolotti

containers_cpp: add tests for blocking priority queue + get rid of namespace in…

containers_cpp: add tests for blocking priority queue + get rid of namespace in blocking container class
parent 526d902a
......@@ -34,7 +34,6 @@
namespace embb {
namespace containers {
using namespace base;
/*
* Abstract class to use for the implementation of blocking datastructure.
......@@ -44,6 +43,7 @@ using namespace base;
*/
template < typename Type >
class BlockingContainer {
typedef embb::base::Mutex Mutex;
protected:
/*
* Mutex for thread synchronization.
......@@ -54,7 +54,7 @@ class BlockingContainer {
* Condition variable for notifying threads that are waiting
* for popping elements that new elements are available.
*/
ConditionVariable condition;
embb::base::ConditionVariable condition;
/**
* Pure virtual method to be implemented in derived classes.
......
......@@ -35,7 +35,7 @@ namespace containers {
template<typename T>
void BlockingContainer<T>::PushAndWakeUp(const T& element) {
LockGuard<Mutex> lock(mutex);
embb::base::LockGuard<Mutex> lock(mutex);
SpecializedPush(element);
......@@ -44,7 +44,7 @@ void BlockingContainer<T>::PushAndWakeUp(const T& element) {
template<typename T>
void BlockingContainer<T>::BlockingPop(T& element) {
UniqueLock<Mutex> lock(mutex);
embb::base::UniqueLock<Mutex> lock(mutex);
while (IsEmpty()) {
condition.Wait(lock);
......
......@@ -32,6 +32,7 @@
#include <embb/containers/blocking_stack.h>
#include <embb/containers/lock_free_mpmc_queue.h>
#include <embb/containers/blocking_queue.h>
#include <embb/containers/blocking_priority_queue.h>
#include <embb/containers/blocking_set.h>
#include <embb/containers/blocking_map.h>
#include <embb/base/c/memory_allocation.h>
......@@ -56,6 +57,7 @@ using embb::containers::LockFreeTreeValuePool;
using embb::containers::WaitFreeSPSCQueue;
using embb::containers::LockFreeMPMCQueue;
using embb::containers::BlockingQueue;
using embb::containers::BlockingPriorityQueue;
using embb::containers::LockFreeStack;
using embb::containers::BlockingStack;
using embb::containers::LockFreeTreeValuePool;
......@@ -86,6 +88,7 @@ PT_MAIN("Data Structures C++") {
PT_RUN(QueueTest< LockFreeMPMCQueue< ::std::pair<size_t COMMA int> >
COMMA true COMMA true >);
PT_RUN(BlockingQueueTest< BlockingQueue<int> >);
PT_RUN(BlockingQueueTest< BlockingPriorityQueue<int> >);
PT_RUN(StackTest< LockFreeStack<int> >);
PT_RUN(BlockingStackTest< BlockingStack<int> >);
PT_RUN(SetTest< BlockingSet<int> >);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment