diff --git a/include/bx/macros.h b/include/bx/macros.h index 9f8253d..35b3ebe 100644 --- a/include/bx/macros.h +++ b/include/bx/macros.h @@ -55,8 +55,8 @@ # define BX_TRACE(...) do {} while(0) #endif // BX_TRACE -#ifndef BX_CONFIG_SPSCQUEUE_USE_NAIVE -# define BX_CONFIG_SPSCQUEUE_USE_NAIVE 0 -#endif // BX_CONFIG_SPSCQUEUE_USE_NAIVE +#ifndef BX_CONFIG_SPSCQUEUE_USE_MUTEX +# define BX_CONFIG_SPSCQUEUE_USE_MUTEX 0 +#endif // BX_CONFIG_SPSCQUEUE_USE_MUTEX #endif // __BX_MACROS_H__ diff --git a/include/bx/spscqueue.h b/include/bx/spscqueue.h index 700834e..6ca4ab8 100644 --- a/include/bx/spscqueue.h +++ b/include/bx/spscqueue.h @@ -17,17 +17,17 @@ namespace bx { // http://drdobbs.com/article/print?articleId=210604448&siteSectionName= template - class SpScUnboundedQueueOptimized + class SpScUnboundedQueueLf { public: - SpScUnboundedQueueOptimized() + SpScUnboundedQueueLf() : m_first(new Node(NULL) ) , m_divider(m_first) , m_last(m_first) { } - ~SpScUnboundedQueueOptimized() + ~SpScUnboundedQueueLf() { while (NULL != m_first) { @@ -73,8 +73,8 @@ namespace bx } private: - SpScUnboundedQueueOptimized(const SpScUnboundedQueueOptimized& _rhs); // no copy constructor - SpScUnboundedQueueOptimized& operator=(const SpScUnboundedQueueOptimized& _rhs); // no assignment operator + SpScUnboundedQueueLf(const SpScUnboundedQueueLf& _rhs); // no copy constructor + SpScUnboundedQueueLf& operator=(const SpScUnboundedQueueLf& _rhs); // no assignment operator struct Node { @@ -94,14 +94,14 @@ namespace bx }; template - class SpScUnboundedQueueNaive + class SpScUnboundedQueueMutex { public: - SpScUnboundedQueueNaive() + SpScUnboundedQueueMutex() { } - ~SpScUnboundedQueueNaive() + ~SpScUnboundedQueueMutex() { BX_CHECK(m_queue.empty(), "Queue is not empty!"); } @@ -141,11 +141,11 @@ namespace bx std::list m_queue; }; -#if BX_CONFIG_SPSCQUEUE_USE_NAIVE -# define SpScUnboundedQueue SpScUnboundedQueueNaive +#if BX_CONFIG_SPSCQUEUE_USE_MUTEX +# define SpScUnboundedQueue SpScUnboundedQueueMutex #else -# define SpScUnboundedQueue SpScUnboundedQueueOptimized -#endif // BX_CONFIG_NAIVE +# define SpScUnboundedQueue SpScUnboundedQueueLf +#endif // BX_CONFIG_SPSCQUEUE_USE_MUTEX } // namespace bx