当前位置: 首页>>代码示例>>C++>>正文


C++ QUEUE_INSERT_TAIL函数代码示例

本文整理汇总了C++中QUEUE_INSERT_TAIL函数的典型用法代码示例。如果您正苦于以下问题:C++ QUEUE_INSERT_TAIL函数的具体用法?C++ QUEUE_INSERT_TAIL怎么用?C++ QUEUE_INSERT_TAIL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了QUEUE_INSERT_TAIL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tls__reset

void tls__reset(tr_uv_tcp_transport_t* tt)
{
    int ret;
    QUEUE* q;

    tr_uv_tls_transport_t* tls = (tr_uv_tls_transport_t* )tt;

    pc_lib_log(PC_LOG_DEBUG, "tls__reset - reset ssl");
    if (!SSL_clear(tls->tls)) {
        pc_lib_log(PC_LOG_WARN, "tls__reset - ssl clear error: %s",
                ERR_error_string(ERR_get_error(), NULL));
    }

    ret = BIO_reset(tls->in);
    assert(ret == 1);

    ret = BIO_reset(tls->out);
    assert(ret == 1);

    // write should retry remained, insert it to writing queue
    // then tcp__reset will recycle it.
    if (tls->should_retry) {
        pc_lib_log(PC_LOG_DEBUG, "tls__reset - move should retry wi to writing queue, seq_num: %u, req_id: %u",
                tls->should_retry->seq_num, tls->should_retry->req_id);

        QUEUE_INIT(&tls->should_retry->queue);
        QUEUE_INSERT_TAIL(&tt->writing_queue, &tls->should_retry->queue);

        tls->should_retry = NULL;
    } 

    if (tls->retry_wb) {
        pc_lib_free(tls->retry_wb);
        tls->retry_wb = NULL;
        tls->retry_wb_len = 0;
    }

    // tcp reset will recycle following write item
    while(!QUEUE_EMPTY(&tls->when_tcp_is_writing_queue)) {
        q = QUEUE_HEAD(&tls->when_tcp_is_writing_queue);
        QUEUE_REMOVE(q);
        QUEUE_INIT(q);

        QUEUE_INSERT_TAIL(&tt->writing_queue, q);
    }
    
    tcp__reset(tt);
}
开发者ID:afreejun,项目名称:libpomelo2,代码行数:48,代码来源:tr_uv_tls_aux.c

示例2: cmdBufAllocateCmdInfo

/*----------------------------------------------------------------------------*/
P_CMD_INFO_T cmdBufAllocateCmdInfo(IN P_ADAPTER_T prAdapter, IN UINT_32 u4Length)
{
	P_CMD_INFO_T prCmdInfo;
	KAL_SPIN_LOCK_DECLARATION();

	DEBUGFUNC("cmdBufAllocateCmdInfo");


	ASSERT(prAdapter);

	KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE);
	QUEUE_REMOVE_HEAD(&prAdapter->rFreeCmdList, prCmdInfo, P_CMD_INFO_T);
	KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE);

	if (prCmdInfo) {
		/* Setup initial value in CMD_INFO_T */
		/* Start address of allocated memory */
		prCmdInfo->pucInfoBuffer = cnmMemAlloc(prAdapter, RAM_TYPE_BUF, u4Length);

		if (prCmdInfo->pucInfoBuffer == NULL) {
			KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE);
			QUEUE_INSERT_TAIL(&prAdapter->rFreeCmdList, &prCmdInfo->rQueEntry);
			KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE);

			prCmdInfo = NULL;
		} else {
			prCmdInfo->u2InfoBufLen = 0;
			prCmdInfo->fgIsOid = FALSE;
			prCmdInfo->fgDriverDomainMCR = FALSE;
		}
	}

	return prCmdInfo;

}				/* end of cmdBufAllocateCmdInfo() */
开发者ID:AudioGod,项目名称:MediaTek-HelioX10-Kernel,代码行数:36,代码来源:cmd_buf.c

示例3: cnmMgtPktFree

/*----------------------------------------------------------------------------*/
VOID
cnmMgtPktFree (
    P_ADAPTER_T     prAdapter,
    P_MSDU_INFO_T   prMsduInfo
    )
{
    P_QUE_T         prQueList;
    KAL_SPIN_LOCK_DECLARATION();

    ASSERT(prAdapter);
    ASSERT(prMsduInfo);

    prQueList = &prAdapter->rTxCtrl.rFreeMsduInfoList;

    ASSERT(prMsduInfo->prPacket);
    if (prMsduInfo->prPacket) {
        cnmMemFree(prAdapter, prMsduInfo->prPacket);
        prMsduInfo->prPacket = NULL;
    }

    KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST);
    //added by zhaoyun.wu for 438323,438318,438313 mtk_patch 2015.7.24 begin
    prMsduInfo->fgIsBasicRate = FALSE; //add this line
    //added by zhaoyun.wu for 438323,438318,438313 mtk_patch 2015.7.24 end
    QUEUE_INSERT_TAIL(prQueList, &prMsduInfo->rQueEntry)
    KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST);
}
开发者ID:hacknmtk,项目名称:android_kernel_alcatel_5017,代码行数:28,代码来源:cnm_mem.c

示例4: uv__io_start

void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
  assert(0 == (events & ~(POLLIN | POLLOUT | UV__POLLRDHUP)));
  assert(0 != events);
  assert(w->fd >= 0);
  assert(w->fd < INT_MAX);

  w->pevents |= events;
  maybe_resize(loop, w->fd + 1);

#if !defined(__sun)
  /* The event ports backend needs to rearm all file descriptors on each and
   * every tick of the event loop but the other backends allow us to
   * short-circuit here if the event mask is unchanged.
   */
  if (w->events == w->pevents) {
    if (w->events == 0 && !QUEUE_EMPTY(&w->watcher_queue)) {
      QUEUE_REMOVE(&w->watcher_queue);
      QUEUE_INIT(&w->watcher_queue);
    }
    return;
  }
#endif

  if (QUEUE_EMPTY(&w->watcher_queue))
    QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue);

  if (loop->watchers[w->fd] == NULL) {
    loop->watchers[w->fd] = w;
    loop->nfds++;
  }
}
开发者ID:Fantasticer,项目名称:libuv,代码行数:31,代码来源:core.c

示例5: ravaL_cond_wait

int ravaL_cond_wait(rava_cond_t* cond, rava_state_t* curr)
{
  QUEUE_INSERT_TAIL(cond, &curr->cond);
  TRACE("SUSPEND state %p\n", curr);

  return ravaL_state_suspend(curr);
}
开发者ID:frinknet,项目名称:rava,代码行数:7,代码来源:rava_process_cond.c

示例6: post

static void post(QUEUE* q) {
  if (initialized == 0) return;
  uv_mutex_lock(&mutex);
  QUEUE_INSERT_TAIL(&wq, q);
  uv_cond_signal(&cond);
  uv_mutex_unlock(&mutex);
}
开发者ID:Andrepuel,项目名称:jxcore,代码行数:7,代码来源:threadpool.c

示例7: post

static void post(QUEUE* q) {
  uv_mutex_lock(&mutex);
  QUEUE_INSERT_TAIL(&wq, q);
  if (idle_threads > 0)
    uv_cond_signal(&cond);
  uv_mutex_unlock(&mutex);
}
开发者ID:pilight,项目名称:pilight,代码行数:7,代码来源:threadpool.c

示例8: uv__io_stop

void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
  assert(0 == (events & ~(POLLIN | POLLOUT | UV__POLLRDHUP)));
  assert(0 != events);

  if (w->fd == -1)
    return;

  assert(w->fd >= 0);

  /* Happens when uv__io_stop() is called on a handle that was never started. */
  if ((unsigned) w->fd >= loop->nwatchers)
    return;

  w->pevents &= ~events;

  if (w->pevents == 0) {
    QUEUE_REMOVE(&w->watcher_queue);
    QUEUE_INIT(&w->watcher_queue);

    if (loop->watchers[w->fd] != NULL) {
      assert(loop->watchers[w->fd] == w);
      assert(loop->nfds > 0);
      loop->watchers[w->fd] = NULL;
      loop->nfds--;
      w->events = 0;
    }
  }
  else if (QUEUE_EMPTY(&w->watcher_queue))
    QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue);
}
开发者ID:Fantasticer,项目名称:libuv,代码行数:30,代码来源:core.c

示例9: queue_push

void queue_push(Queue *queue, Event event)
{
  queue_item *item = malloc(sizeof(queue_item));
  item->item = event;
  QUEUE_INIT(&item->node);
  QUEUE_INSERT_TAIL(&queue->headtail, &item->node);
}
开发者ID:jollywho,项目名称:nav,代码行数:7,代码来源:event.c

示例10: malloc

evt_tls_t *getSSL(evt_ctx_t *d_eng)
{
     evt_tls_t *con = malloc(sizeof(evt_tls_t));
     if ( !con ) {
	 return NULL;
     }
     memset( con, 0, sizeof *con);

     SSL *ssl  = SSL_new(d_eng->ctx);

     if ( !ssl ) {
	 return NULL;
     }
     con->ssl = ssl;

     //use default buf size for now.
     BIO_new_bio_pair(&(con->ssl_bio_), 0, &(con->app_bio_), 0);

     SSL_set_bio(con->ssl, con->ssl_bio_, con->ssl_bio_);

     QUEUE_INIT(&(con->q));
     QUEUE_INSERT_TAIL(&(d_eng->live_con), &(con->q));

     con->writer = d_eng->writer;

     return con;
}
开发者ID:sandeep-parmar,项目名称:libuv-tls,代码行数:27,代码来源:evt_tls.c

示例11: uv_loop_fork

int uv_loop_fork(uv_loop_t* loop) {
  int err;
  unsigned int i;
  uv__io_t* w;

  err = uv__io_fork(loop);
  if (err)
    return err;

  err = uv__async_fork(loop);
  if (err)
    return err;

  err = uv__signal_loop_fork(loop);
  if (err)
    return err;

  /* Rearm all the watchers that aren't re-queued by the above. */
  for (i = 0; i < loop->nwatchers; i++) {
    w = loop->watchers[i];
    if (w == NULL)
      continue;

    if (w->pevents != 0 && QUEUE_EMPTY(&w->watcher_queue)) {
      w->events = 0; /* Force re-registration in uv__io_poll. */
      QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue);
    }
  }

  return 0;
}
开发者ID:AustinShalit,项目名称:allwpilib,代码行数:31,代码来源:loop.cpp

示例12: uv__udp_finish_close

void uv__udp_finish_close(uv_udp_t* handle) {
  uv_udp_send_t* req;
  QUEUE* q;

  assert(!uv__io_active(&handle->io_watcher, UV__POLLIN | UV__POLLOUT));
  assert(handle->io_watcher.fd == -1);

  while (!QUEUE_EMPTY(&handle->write_queue)) {
    q = QUEUE_HEAD(&handle->write_queue);
    QUEUE_REMOVE(q);

    req = QUEUE_DATA(q, uv_udp_send_t, queue);
    req->status = -ECANCELED;
    QUEUE_INSERT_TAIL(&handle->write_completed_queue, &req->queue);
  }

  uv__udp_run_completed(handle);

  assert(handle->send_queue_size == 0);
  assert(handle->send_queue_count == 0);

  /* Now tear down the handle. */
  handle->recv_cb = NULL;
  handle->alloc_cb = NULL;
  /* but _do not_ touch close_cb */
}
开发者ID:Muraad,项目名称:harmony,代码行数:26,代码来源:udp.c

示例13: rava_fiber_join

static int rava_fiber_join(lua_State* L)
{
  rava_fiber_t* self = (rava_fiber_t*)luaL_checkudata(L, 1, RAVA_PROCESS_FIBER);
  rava_state_t* curr = (rava_state_t*)ravaL_state_self(L);

  TRACE("joining fiber[%p], from [%p]\n", self, curr);

  assert((rava_state_t*)self != curr);

  if (self->flags & RAVA_STATE_DEAD) {
    /* seen join after termination */
    TRACE("join after termination\n");

    return ravaL_state_xcopy((rava_state_t*)self, curr);
  }

  QUEUE_INSERT_TAIL(&self->rouse, &curr->join);

  ravaL_fiber_ready(self);

  TRACE("calling ravaL_state_suspend on %p\n", curr);

  if (curr->type == RAVA_STATE_TYPE_FIBER) {
    return ravaL_state_suspend(curr);
	} else {
    ravaL_state_suspend(curr);

    return ravaL_state_xcopy((rava_state_t*)self, curr);
  }
}
开发者ID:frinknet,项目名称:rava,代码行数:30,代码来源:rava_process_fiber.c

示例14: cmdBufFreeCmdInfo

/*----------------------------------------------------------------------------*/
VOID
cmdBufFreeCmdInfo (
    IN P_ADAPTER_T  prAdapter,
    IN P_CMD_INFO_T prCmdInfo
    )
{
    KAL_SPIN_LOCK_DECLARATION();

    DEBUGFUNC("cmdBufFreeCmdInfo");


    ASSERT(prAdapter);
    ASSERT(prCmdInfo);

    if (prCmdInfo) {
        if (prCmdInfo->pucInfoBuffer) {
            cnmMemFree(prAdapter, prCmdInfo->pucInfoBuffer);
            prCmdInfo->pucInfoBuffer = NULL;
        }

        KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE);
        QUEUE_INSERT_TAIL(&prAdapter->rFreeCmdList, &prCmdInfo->rQueEntry);
        KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE);
    }

    return;

} /* end of cmdBufFreeCmdPacket() */
开发者ID:32743069,项目名称:amlogic_common_3050,代码行数:29,代码来源:cmd_buf.c

示例15: uv__inotify_read

static void uv__inotify_read(uv_loop_t* loop,
                             uv__io_t* dummy,
                             unsigned int events) {
  const struct uv__inotify_event* e;
  struct watcher_list* w;
  uv_fs_event_t* h;
  QUEUE queue;
  QUEUE* q;
  const char* path;
  ssize_t size;
  const char *p;
  /* needs to be large enough for sizeof(inotify_event) + strlen(path) */
  char buf[4096];

  while (1) {
    do
      size = read(loop->inotify_fd, buf, sizeof(buf));
    while (size == -1 && errno == EINTR);

    if (size == -1) {
      assert(errno == EAGAIN || errno == EWOULDBLOCK);
      break;
    }

    assert(size > 0); /* pre-2.6.21 thing, size=0 == read buffer too small */

    /* Now we have one or more inotify_event structs. */
    for (p = buf; p < buf + size; p += sizeof(*e) + e->len) {
      e = (const struct uv__inotify_event*)p;

      events = 0;
      if (e->mask & (UV__IN_ATTRIB|UV__IN_MODIFY))
        events |= UV_CHANGE;
      if (e->mask & ~(UV__IN_ATTRIB|UV__IN_MODIFY))
        events |= UV_RENAME;

      w = find_watcher(loop, e->wd);
      if (w == NULL)
        continue; /* Stale event, no watchers left. */

      /* inotify does not return the filename when monitoring a single file
       * for modifications. Repurpose the filename for API compatibility.
       * I'm not convinced this is a good thing, maybe it should go.
       */
      path = e->len ? (const char*) (e + 1) : uv__basename_r(w->path);

      QUEUE_MOVE(&w->watchers, &queue);
      while (!QUEUE_EMPTY(&queue)) {
        q = QUEUE_HEAD(&queue);
        h = QUEUE_DATA(q, uv_fs_event_t, watchers);

        QUEUE_REMOVE(q);
        QUEUE_INSERT_TAIL(&w->watchers, q);

        h->cb(h, path, events, 0);
      }
    }
  }
}
开发者ID:MaxTan,项目名称:cozy,代码行数:59,代码来源:linux-inotify.c


注:本文中的QUEUE_INSERT_TAIL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。