From cc6bec3330c29cc29f54d3e3d919d510f0197641 Mon Sep 17 00:00:00 2001 From: wzq <wzq@localhost.localdomain> Date: 星期六, 22 八月 2020 19:35:42 +0800 Subject: [PATCH] update --- src/queue/include/lock_free_queue.h | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/queue/include/lock_free_queue.h b/src/queue/include/lock_free_queue.h index 6ba2a00..17e8c56 100644 --- a/src/queue/include/lock_free_queue.h +++ b/src/queue/include/lock_free_queue.h @@ -117,7 +117,7 @@ /// @return true if the element was inserted in the queue. False if the queue was full bool push(const ELEM_T &a_data); bool push_nowait(const ELEM_T &a_data); - bool push_timeout(const ELEM_T &a_data, struct timespec * timeout); + bool push_timeout(const ELEM_T &a_data, const struct timespec * timeout); /// @brief pop the element at the head of the queue /// @param a reference where the element in the head of the queue will be saved to @@ -200,7 +200,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"); + // printf("==================LockFreeQueue push before\n"); if (SemUtil::dec(slots) == -1) { err_msg(errno, "LockFreeQueue push"); return false; @@ -209,7 +209,7 @@ if ( m_qImpl.push(a_data) ) { SemUtil::inc(items); -// printf("==================LockFreeQueue push after\n"); + // printf("==================LockFreeQueue push after\n"); return true; } return false; @@ -244,7 +244,7 @@ typename ELEM_T, typename Allocator, template <typename T, typename AT> class Q_TYPE> -bool LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::push_timeout(const ELEM_T &a_data, struct timespec * timeout) +bool LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::push_timeout(const ELEM_T &a_data, const struct timespec * timeout) { @@ -252,7 +252,7 @@ if (errno == EAGAIN) return false; else { - err_msg(errno, "LockFreeQueue push_timeout"); + // err_msg(errno, "LockFreeQueue push_timeout"); return false; } } @@ -274,7 +274,7 @@ 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"); + // printf("==================LockFreeQueue pop before\n"); if (SemUtil::dec(items) == -1) { err_msg(errno, "LockFreeQueue pop"); return false; @@ -282,7 +282,7 @@ if (m_qImpl.pop(a_data)) { SemUtil::inc(slots); -// printf("==================LockFreeQueue pop after\n"); + // printf("==================LockFreeQueue pop after\n"); return true; } return false; @@ -319,17 +319,19 @@ 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"); if (SemUtil::dec_timeout(items, timeout) == -1) { if (errno == EAGAIN) return false; else { - err_msg(errno, "LockFreeQueue pop_timeout"); + // err_msg(errno, "LockFreeQueue pop_timeout"); return false; } } if (m_qImpl.pop(a_data)) { - SemUtil::inc(slots); + SemUtil::inc(slots); +// printf("==================LockFreeQueue pop_timeout after\n"); return true; } return false; -- Gitblit v1.8.0