diff --git a/containers_cpp/include/embb/containers/blocking_container.h b/containers_cpp/include/embb/containers/blocking_container.h index fa4a146..3e9a949 100755 --- a/containers_cpp/include/embb/containers/blocking_container.h +++ b/containers_cpp/include/embb/containers/blocking_container.h @@ -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. diff --git a/containers_cpp/include/embb/containers/internal/blocking_container-inl.h b/containers_cpp/include/embb/containers/internal/blocking_container-inl.h index 9e8b813..4753cc2 100755 --- a/containers_cpp/include/embb/containers/internal/blocking_container-inl.h +++ b/containers_cpp/include/embb/containers/internal/blocking_container-inl.h @@ -35,7 +35,7 @@ namespace containers { template void BlockingContainer::PushAndWakeUp(const T& element) { - LockGuard lock(mutex); + embb::base::LockGuard lock(mutex); SpecializedPush(element); @@ -44,7 +44,7 @@ void BlockingContainer::PushAndWakeUp(const T& element) { template void BlockingContainer::BlockingPop(T& element) { - UniqueLock lock(mutex); + embb::base::UniqueLock lock(mutex); while (IsEmpty()) { condition.Wait(lock); diff --git a/containers_cpp/test/main.cc b/containers_cpp/test/main.cc index 8f11809..0d45b03 100644 --- a/containers_cpp/test/main.cc +++ b/containers_cpp/test/main.cc @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -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 > COMMA true COMMA true >); PT_RUN(BlockingQueueTest< BlockingQueue >); + PT_RUN(BlockingQueueTest< BlockingPriorityQueue >); PT_RUN(StackTest< LockFreeStack >); PT_RUN(BlockingStackTest< BlockingStack >); PT_RUN(SetTest< BlockingSet >);