本文整理汇总了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);
}
示例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() */
示例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);
}
示例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++;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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 */
}
示例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);
}
}
示例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() */
示例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);
}
}
}
}