| | |
| | | { |
| | | LoggerFactory::getLogger()->debug("==================LockFreeQueue push before\n"); |
| | | if (psem_wait(&slots) == -1) { |
| | | err_msg(errno, "LockFreeQueue push"); |
| | | return errno; |
| | | return -1; |
| | | } |
| | | |
| | | if ( m_qImpl.push(a_data) ) { |
| | |
| | | int LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::push_nowait(const ELEM_T &a_data) |
| | | { |
| | | if (psem_trywait(&slots) == -1) { |
| | | if (errno == EAGAIN) |
| | | return EAGAIN; |
| | | else { |
| | | err_msg(errno, "LockFreeQueue push_nowait"); |
| | | return errno; |
| | | } |
| | | |
| | | return -1; |
| | | } |
| | | |
| | | if ( m_qImpl.push(a_data)) { |
| | |
| | | int LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::push_timeout(const ELEM_T &a_data, const struct timespec * ts) |
| | | { |
| | | LoggerFactory::getLogger()->debug("==================LockFreeQueue push_timeout before\n"); |
| | | int rv; |
| | | if ( psem_timedwait(&slots, ts) == -1) { |
| | | |
| | | if(errno == ETIMEDOUT) |
| | | return EBUS_TIMEOUT; |
| | | else { |
| | | LoggerFactory::getLogger()->error(errno, "LockFreeQueue push_timeout"); |
| | | return errno; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | if (m_qImpl.push(a_data)){ |
| | |
| | | |
| | | LoggerFactory::getLogger()->debug("==================LockFreeQueue pop before\n"); |
| | | if (psem_wait(&items) == -1) { |
| | | LoggerFactory::getLogger()->error(errno, "LockFreeQueue pop"); |
| | | return errno; |
| | | return -1; |
| | | } |
| | | |
| | | if (m_qImpl.pop(a_data)) { |
| | |
| | | int LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::pop_nowait(ELEM_T &a_data) |
| | | { |
| | | if (psem_trywait(&items) == -1) { |
| | | if (errno == EAGAIN) |
| | | return errno; |
| | | else { |
| | | LoggerFactory::getLogger()->error(errno, "LockFreeQueue pop_nowait"); |
| | | return errno; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | if (m_qImpl.pop(a_data)) { |
| | |
| | | int LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::pop_timeout(ELEM_T &a_data, struct timespec * ts) |
| | | { |
| | | if (psem_timedwait(&items, ts) == -1) { |
| | | if (errno == ETIMEDOUT) { |
| | | return EBUS_TIMEOUT; |
| | | } |
| | | |
| | | else { |
| | | LoggerFactory::getLogger()->error(errno, "3 LockFreeQueue pop_timeout %d", errno); |
| | | return errno; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | if (m_qImpl.pop(a_data)) { |