wangzhengquan
2021-01-26 0cb4f2b1acb16c1ee1bd86a40116300ea2e2cdaa
src/queue/lock_free_queue.h
@@ -211,10 +211,10 @@
      template<typename T, typename AT> class Q_TYPE>
int LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::push(const ELEM_T &a_data, const struct timespec *timeout, int flag) {
  // LoggerFactory::getLogger()->debug("==================LockFreeQueue push before\n");
  sigset_t mask_all, pre;
  sigfillset(&mask_all);
  // sigset_t mask_all, pre;
  // sigfillset(&mask_all);
  sigprocmask(SIG_BLOCK, &mask_all, &pre);
  // sigprocmask(SIG_BLOCK, &mask_all, &pre);
  if ((flag & BUS_NOWAIT_FLAG) == BUS_NOWAIT_FLAG) {
      if (psem_trywait(&slots) == -1) {
@@ -233,13 +233,13 @@
  if (m_qImpl.push(a_data)) {
    psem_post(&items);
    sigprocmask(SIG_SETMASK, &pre, NULL);
    // sigprocmask(SIG_SETMASK, &pre, NULL);
    LoggerFactory::getLogger()->debug("==================LockFreeQueue push after\n");
    return 0;
  }
  
LABEL_FAILTURE:
  sigprocmask(SIG_SETMASK, &pre, NULL);
  // sigprocmask(SIG_SETMASK, &pre, NULL);
  return errno;
}
@@ -249,10 +249,10 @@
int LockFreeQueue<ELEM_T, Allocator, Q_TYPE>::pop(ELEM_T &a_data, const struct timespec *timeout, int flag) {
  // LoggerFactory::getLogger()->debug("==================LockFreeQueue pop before....");
  sigset_t mask_all, pre;
  sigfillset(&mask_all);
  // sigset_t mask_all, pre;
  // sigfillset(&mask_all);
  sigprocmask(SIG_BLOCK, &mask_all, &pre);
  // sigprocmask(SIG_BLOCK, &mask_all, &pre);
  if ((flag & BUS_NOWAIT_FLAG) == BUS_NOWAIT_FLAG) {
      if (psem_trywait(&items) == -1) {
@@ -272,13 +272,13 @@
  if (m_qImpl.pop(a_data)) {
      psem_post(&slots);
      sigprocmask(SIG_SETMASK, &pre, NULL);
      // sigprocmask(SIG_SETMASK, &pre, NULL);
      // LoggerFactory::getLogger()->debug("==================LockFreeQueue pop after\n");
      return 0;
  }
LABEL_FAILTURE:
  sigprocmask(SIG_SETMASK, &pre, NULL);
  // sigprocmask(SIG_SETMASK, &pre, NULL);
  return errno;
}