From e4130d29e80a40884310481ded90ff845c614f43 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期四, 24 十二月 2020 10:03:14 +0800 Subject: [PATCH] bus force bind --- src/queue/lock_free_queue.h | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/queue/lock_free_queue.h b/src/queue/lock_free_queue.h index 281b7e5..84c885c 100644 --- a/src/queue/lock_free_queue.h +++ b/src/queue/lock_free_queue.h @@ -11,6 +11,7 @@ // default Queue size #define LOCK_FREE_Q_DEFAULT_SIZE 16 +// static Logger *logger = LoggerFactory::getLogger(); // define this macro if calls to "size" must return the real size of the // queue. If it is undefined that function will try to take a snapshot of // the queue, but returned value might be bogus @@ -160,7 +161,7 @@ template <typename T, typename AT> class Q_TYPE> LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::~LockFreeQueue() { - LoggerFactory::getLogger()->debug("LockFreeQueue desctroy"); + // LoggerFactory::getLogger()->debug("LockFreeQueue desctroy"); SemUtil::remove(slots); SemUtil::remove(items); SemUtil::remove(mutex); @@ -200,7 +201,7 @@ template <typename T, typename AT> class Q_TYPE> bool LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::push(const ELEM_T &a_data) { - // printf("==================LockFreeQueue push before\n"); +LoggerFactory::getLogger()->debug("==================LockFreeQueue push before\n"); if (SemUtil::dec(slots) == -1) { err_msg(errno, "LockFreeQueue push"); return false; @@ -209,7 +210,7 @@ if ( m_qImpl.push(a_data) ) { SemUtil::inc(items); - // printf("==================LockFreeQueue push after\n"); +LoggerFactory::getLogger()->debug("==================LockFreeQueue push after\n"); return true; } return false; @@ -247,18 +248,19 @@ bool LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::push_timeout(const ELEM_T &a_data, const struct timespec * timeout) { - +LoggerFactory::getLogger()->debug("==================LockFreeQueue push_timeout before\n"); if (SemUtil::dec_timeout(slots, timeout) == -1) { if (errno == EAGAIN) return false; else { - // err_msg(errno, "LockFreeQueue push_timeout"); + err_msg(errno, "LockFreeQueue push_timeout"); return false; } } if (m_qImpl.push(a_data)){ - SemUtil::inc(items); + SemUtil::inc(items); +LoggerFactory::getLogger()->debug("==================LockFreeQueue push_timeout after\n"); return true; } return false; @@ -274,7 +276,8 @@ template <typename T, typename AT> class Q_TYPE> bool LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::pop(ELEM_T &a_data) { - // printf("==================LockFreeQueue pop before\n"); + +LoggerFactory::getLogger()->debug("==================LockFreeQueue pop before\n"); if (SemUtil::dec(items) == -1) { err_msg(errno, "LockFreeQueue pop"); return false; @@ -282,7 +285,7 @@ if (m_qImpl.pop(a_data)) { SemUtil::inc(slots); - // printf("==================LockFreeQueue pop after\n"); +LoggerFactory::getLogger()->debug("==================LockFreeQueue pop after\n"); return true; } return false; @@ -319,7 +322,7 @@ template <typename T, typename AT> class Q_TYPE> bool LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::pop_timeout(ELEM_T &a_data, struct timespec * timeout) { -// printf("==================LockFreeQueue pop_timeout before\n"); +LoggerFactory::getLogger()->debug("==================LockFreeQueue pop_timeout before\n"); if (SemUtil::dec_timeout(items, timeout) == -1) { if (errno == EAGAIN) return false; @@ -331,7 +334,7 @@ if (m_qImpl.pop(a_data)) { SemUtil::inc(slots); -// printf("==================LockFreeQueue pop_timeout after\n"); +LoggerFactory::getLogger()->debug("==================LockFreeQueue pop_timeout after\n"); return true; } return false; @@ -346,6 +349,7 @@ return m_qImpl.operator[](i); } + template < typename ELEM_T, typename Allocator, -- Gitblit v1.8.0