| | |
| | | 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; |
| | |
| | | if ( m_qImpl.push(a_data) ) { |
| | | |
| | | SemUtil::inc(items); |
| | | // printf("==================LockFreeQueue push after\n"); |
| | | // printf("==================LockFreeQueue push after\n"); |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | 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; |
| | |
| | | |
| | | if (m_qImpl.pop(a_data)) { |
| | | SemUtil::inc(slots); |
| | | // printf("==================LockFreeQueue pop after\n"); |
| | | // printf("==================LockFreeQueue pop after\n"); |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | if (m_qImpl.pop(a_data)) { |
| | | SemUtil::inc(slots); |
| | | SemUtil::inc(slots); |
| | | // printf("==================LockFreeQueue pop_timeout after\n"); |
| | | return true; |
| | | } |
| | | return false; |