From 5c912c70e9333298ff48f7ea15424f72ca977b99 Mon Sep 17 00:00:00 2001 From: Fu Juntang <StrongTiger_001@163.com> Date: 星期五, 17 九月 2021 09:43:55 +0800 Subject: [PATCH] Add the heartbeat logic feature. --- src/queue/array_lock_free_sem_queue.h | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/queue/array_lock_free_sem_queue.h b/src/queue/array_lock_free_sem_queue.h index 5f56dda..cf1266d 100644 --- a/src/queue/array_lock_free_sem_queue.h +++ b/src/queue/array_lock_free_sem_queue.h @@ -4,7 +4,7 @@ #include <assert.h> // assert() #include <sched.h> // sched_yield() #include "logger_factory.h" -#include "mem_pool.h" +#include "shm_mm.h" #include "shm_allocator.h" #include "futex_sem.h" #include "time_util.h" @@ -241,8 +241,8 @@ if( (flag & BUS_NOWAIT_FLAG) == BUS_NOWAIT_FLAG) return errno; else if( (flag & BUS_TIMEOUT_FLAG) == BUS_TIMEOUT_FLAG && timeout != NULL) { - const struct timespec ts = TimeUtil::trim_time(timeout); - s = futex((int *)&m_readIndex, FUTEX_WAIT, tmpIndex, &ts, NULL, 0); + + s = futex((int *)&m_readIndex, FUTEX_WAIT, tmpIndex, timeout, NULL, 0); if (s == -1 && errno != EAGAIN && errno != EINTR) { // err_exit("ArrayLockFreeSemQueue<ELEM_T, Allocator>::push futex-FUTEX_WAIT"); return errno; @@ -320,8 +320,7 @@ return errno; } else if( (flag & BUS_TIMEOUT_FLAG) == BUS_TIMEOUT_FLAG && timeout != NULL) { - const struct timespec ts = TimeUtil::trim_time(timeout); - s = futex((int *)&m_count, FUTEX_WAIT, 0, &ts, NULL, 0); + s = futex((int *)&m_count, FUTEX_WAIT, 0, timeout, NULL, 0); if (s == -1 && errno != EAGAIN && errno != EINTR) { // err_exit("ArrayLockFreeSemQueue<ELEM_T, Allocator>::push futex-FUTEX_WAIT"); // sigprocmask(SIG_SETMASK, &pre, NULL); -- Gitblit v1.8.0