这篇教程C++ uv_idle_stop函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uv_idle_stop函数的典型用法代码示例。如果您正苦于以下问题:C++ uv_idle_stop函数的具体用法?C++ uv_idle_stop怎么用?C++ uv_idle_stop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uv_idle_stop函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: socket_closing_cb/** * This one is asynchronously triggered, so as to ensure we don't have any * silly re-entrancy issues. */static void socket_closing_cb(uv_idle_t *idle, int status){ my_sockdata_t *sock = idle->data; uv_idle_stop(idle); uv_close((uv_handle_t *)idle, generic_close_cb); if (sock->pending.read) { /** * UV doesn't invoke read callbacks once the handle has been closed * so we must track this ourselves. */ lcb_assert(sock->pending.read == 1); uv_read_stop((uv_stream_t *)&sock->tcp); sock->pending.read--; decref_sock(sock); }#ifdef DEBUG if (sock->pending.read || sock->pending.write) { sock_dump_pending(sock); }#endif decref_sock(sock); sock_do_uv_close(sock); (void)status;}
开发者ID:uvenum,项目名称:libcouchbase,代码行数:33,
示例2: idle_1_cbstatic void idle_1_cb(uv_handle_t* handle, int status) { int r; LOG("IDLE_1_CB/n"); ASSERT(handle != NULL); ASSERT(status == 0); ASSERT(idles_1_active > 0); /* Init idle_2 and make it active */ if (!idle_2_is_active) { r = uv_idle_init(&idle_2_handle, idle_2_close_cb, NULL); ASSERT(r == 0); r = uv_idle_start(&idle_2_handle, idle_2_cb); ASSERT(r == 0); idle_2_is_active = 1; idle_2_cb_started++; } idle_1_cb_called++; if (idle_1_cb_called % 5 == 0) { r = uv_idle_stop((uv_idle_t*)handle); ASSERT(r == 0); idles_1_active--; }}
开发者ID:BrettQ,项目名称:node,代码行数:28,
示例3: wait_for_a_while/* is reexecuted until uv_idle_stop is called */void wait_for_a_while(uv_idle_t* handle, int status) { counter++; if (counter >= 10e6) /* stops the idle handle */ uv_idle_stop(handle);}
开发者ID:cloud-hot,项目名称:libuv-snippets,代码行数:8,
示例4: release_main_loopintrelease_main_loop(){ int returnValue = 0; SOL_DBG("Entering with state %s", RESOLVE_MAINLOOP_STATE(mainloopState)); if (mainloopState == MAINLOOP_RELEASED || mainloopState == MAINLOOP_RELEASING_STARTED) { return returnValue; } SOL_DBG("Stopping token handle"); returnValue = uv_prepare_stop(&uv_token_handle); if (returnValue) { return returnValue; } // hijack_main_loop() was called, but the idler has not run yet if (mainloopState == MAINLOOP_HIJACKING_STARTED) { SOL_DBG("idler has not run yet, so stopping it"); returnValue = uv_idle_stop(&uv_idle); if (!returnValue) { mainloopState = MAINLOOP_RELEASED; } } else { SOL_DBG("quitting main loop"); mainloopState = MAINLOOP_RELEASING_STARTED; sol_quit(); } return returnValue;}
开发者ID:Learn-iot,项目名称:soletta,代码行数:31,
示例5: idle_cbstatic void idle_cb(uv_idle_t* handle, int status) { ASSERT(handle == &idle_handle); ASSERT(status == 0); if (++idle_counter == NUM_TICKS) uv_idle_stop(handle);}
开发者ID:2hanson,项目名称:node,代码行数:7,
示例6: waitForAWhilevoid waitForAWhile(uv_idle_t *handle) { counter++; if (counter >= 10e6) { uv_idle_stop(handle); }}
开发者ID:kapilash,项目名称:dc,代码行数:7,
示例7: luv_idle_stopstatic int luv_idle_stop(lua_State* L) { uv_idle_t* handle = luv_check_idle(L, 1); int ret = uv_idle_stop(handle); if (ret < 0) return luv_error(L, ret); lua_pushinteger(L, ret); return 1;}
开发者ID:joerg-krause,项目名称:luv,代码行数:7,
示例8: lws_uv_idlestatic voidlws_uv_idle(uv_idle_t *handle#if UV_VERSION_MAJOR == 0 , int status#endif){ struct lws_context_per_thread *pt = lws_container_of(handle, struct lws_context_per_thread, uv_idle); lwsl_debug("%s/n", __func__); /* * is there anybody with pending stuff that needs service forcing? */ if (!lws_service_adjust_timeout(pt->context, 1, pt->tid)) { /* -1 timeout means just do forced service */ lws_plat_service_tsi(pt->context, -1, pt->tid); /* still somebody left who wants forced service? */ if (!lws_service_adjust_timeout(pt->context, 1, pt->tid)) /* yes... come back again later */ lwsl_debug("%s: done again/n", __func__); return; } /* there is nobody who needs service forcing, shut down idle */ uv_idle_stop(handle); lwsl_debug("%s: done stop/n", __func__);}
开发者ID:paroga,项目名称:libwebsockets,代码行数:30,
示例9: releaseHandle ALWAYS_INLINE void releaseHandle(uv_idle_ext_t *handle) { if(handle->start){ uv_idle_stop((uv_idle_t *) handle); } uv_unref((uv_handle_t *) handle); delete handle; }
开发者ID:RickySu,项目名称:hhvm-ext-uv,代码行数:7,
示例10: next_tickstatic void next_tick(uv_idle_t* handle, int status) { uv_loop_t* loop = handle->loop; uv_idle_stop(handle); uv_idle_init(loop, &idle_handle); uv_idle_start(&idle_handle, idle_cb); uv_timer_init(loop, &timer_handle); uv_timer_start(&timer_handle, timer_cb, 0, 0);}
开发者ID:2hanson,项目名称:node,代码行数:8,
示例11: wait_for_a_whilevoid wait_for_a_while(uv_idle_t *handle) { counter++; if (counter >= 10e6) { // 当执行规定次数后停止 handle printf("wait_for_a_while was called %lli times", counter); uv_idle_stop(handle); }}
开发者ID:CoinXu,项目名称:libuv-example,代码行数:8,
示例12: uv__next_acceptstatic void uv__next_accept(uv_idle_t* idle, int status) { uv_stream_t* stream = idle->data; uv_idle_stop(idle); if (stream->accepted_fd == -1) uv__io_start(stream->loop, &stream->read_watcher);}
开发者ID:IAmAnubhavSaini,项目名称:node,代码行数:8,
示例13: idle_routinestatic void idle_routine(uv_idle_t* h, int status){ ++counter; if (counter >= 10e6) uv_idle_stop(h);}
开发者ID:songtzu,项目名称:study,代码行数:8,
示例14: rstream_stop/// Stops watching for events from a `RStream` instance.////// @param rstream The `RStream` instancevoid rstream_stop(RStream *rstream){ if (rstream->file_type == UV_FILE) { uv_idle_stop(rstream->fread_idle); } else { uv_read_stop(rstream->stream); }}
开发者ID:axblount,项目名称:neovim,代码行数:11,
示例15: l_ffi_resume_cb/** @internal Continue with coroutine. */static void l_ffi_resume_cb(uv_idle_t *check){ lua_State *L = check->data; int status = l_resume(L, 0); if (status != LUA_YIELD) { uv_idle_stop(check); /* Stop coroutine */ uv_close((uv_handle_t *)check, (uv_close_cb)free); } lua_pop(L, lua_gettop(L));}
开发者ID:gitter-badger,项目名称:knot-resolver,代码行数:11,
示例16: callback/** * Callback which will be called upon each event loop tick. */void callback(uv_idle_t* handle) { int* counter = (int*) handle->data; if (*counter == 10) { uv_idle_stop(handle); } else { printf("tick callback.counter = %d/n", *counter); (*counter)++; handle->data = counter; }}
开发者ID:danbev,项目名称:learning-libuv,代码行数:13,
示例17: uv_closeint uv_close(uv_handle_t* handle, uv_close_cb close_cb) { uv_tcp_t* tcp; uv_async_t* async; uv_timer_t* timer; handle->close_cb = close_cb; switch (handle->type) { case UV_TCP: tcp = (uv_tcp_t*) handle; uv_read_stop((uv_stream_t*)tcp); ev_io_stop(EV_DEFAULT_ &tcp->write_watcher); break; case UV_PREPARE: uv_prepare_stop((uv_prepare_t*) handle); break; case UV_CHECK: uv_check_stop((uv_check_t*) handle); break; case UV_IDLE: uv_idle_stop((uv_idle_t*) handle); break; case UV_ASYNC: async = (uv_async_t*)handle; ev_async_stop(EV_DEFAULT_ &async->async_watcher); ev_ref(EV_DEFAULT_UC); break; case UV_TIMER: timer = (uv_timer_t*)handle; if (ev_is_active(&timer->timer_watcher)) { ev_ref(EV_DEFAULT_UC); } ev_timer_stop(EV_DEFAULT_ &timer->timer_watcher); break; default: assert(0); return -1; } uv_flag_set(handle, UV_CLOSING); /* This is used to call the on_close callback in the next loop. */ ev_idle_start(EV_DEFAULT_ &handle->next_watcher); ev_feed_event(EV_DEFAULT_ &handle->next_watcher, EV_IDLE); assert(ev_is_pending(&handle->next_watcher)); return 0;}
开发者ID:markuskopf,项目名称:node,代码行数:54,
示例18: HHVM_METHOD static int64_t HHVM_METHOD(UVIdle, stop) { auto* data = Native::data<UVNativeData>(this_); uv_idle_ext_t *idle_handle = fetchResource(data); int64_t ret = 0; if(idle_handle->start){ ret = uv_idle_stop((uv_idle_t *) idle_handle); this_->decRefAndRelease(); idle_handle->start = false; } return ret; }
开发者ID:RickySu,项目名称:hhvm-ext-uv,代码行数:11,
示例19: wait_for_a_whilevoid wait_for_a_while(uv_idle_t* handle) { static int counter=0; log_info(LOG, "Idle %d", counter); counter++; if (counter > 10) { uv_idle_stop(handle); LOG->close(LOG); }}
开发者ID:cadrian,项目名称:circus,代码行数:11,
示例20: pollEventsstatic void pollEvents(uv_idle_t* handle, int status) { AppInfo* info = (AppInfo*)handle->data; double lastEventTime = info->lastEventTime; double lastUptateTime = info->lastUptateTime; GLFWwindow* window = info->window; glfwPollEvents(); HttpClient::pollEvents(); if(glfwWindowShouldClose(window)) { uv_idle_stop(handle); info->shouldQuit = 1; return; } double t, dt; t = glfwGetTime(); info->lastEventTime = t; dt = t - lastUptateTime; if(dt < 0.016) { // return; } info->lastUptateTime = t; dt = t - lastEventTime; int winWidth, winHeight; int fbWidth, fbHeight; glfwGetWindowSize(window, &winWidth, &winHeight); glfwGetFramebufferSize(window, &fbWidth, &fbHeight); if(winWidth != info->width || winHeight != info->height) { V8Wrapper::resize(winWidth, winHeight); info->width = winWidth; info->height = winHeight; } // Update and render glViewport(0, 0, fbWidth, fbHeight);glClearColor(0.3f, 0.3f, 0.32f, 1.0f); glClearColor(0.3f, 0.3f, 0.32f, 1.0f); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);//////////////////////////////////////////////////////////////////////////////////// V8Wrapper::tick(t, dt);//////////////////////////////////////////////////////////////////////////////////// glfwSwapBuffers(window); return;}
开发者ID:drawapp8,项目名称:cantk-runtime-pc,代码行数:51,
示例21: do_runstatic void do_run(uv_idle_t *runner) { zmq_channel = circus_zmq_client(MEMORY, LOG, config); if (zmq_channel == NULL) { log_error(LOG, "Could not allocate zmq_channel"); LOG->free(LOG); config->free(config); exit(1); } mh = circus_message_handler(MEMORY, LOG, config); if (mh == NULL) { log_error(LOG, "Could not allocate message handler"); zmq_channel->free(zmq_channel); LOG->free(LOG); config->free(config); exit(1); } cgi_channel = circus_cgi(MEMORY, LOG, config); if (cgi_channel == NULL) { log_error(LOG, "Could not allocate cgi_channel"); mh->free(mh); LOG->free(LOG); config->free(config); exit(1); } ch = circus_cgi_handler(MEMORY, LOG, config); if (ch == NULL) { log_error(LOG, "Could not allocate CGI handler"); cgi_channel->free(cgi_channel); mh->free(mh); zmq_channel->free(zmq_channel); LOG->free(LOG); config->free(config); exit(1); } automaton = new_automaton(MEMORY, LOG); assert(automaton->state(automaton) == State_started); mh->register_to(mh, zmq_channel, automaton); ch->register_to(ch, cgi_channel, automaton); automaton->on_state(automaton, State_finished, finished, NULL); automaton->set_state(automaton, State_read_from_client, NULL); log_info(LOG, "Client started."); uv_idle_stop(runner);}
开发者ID:cadrian,项目名称:circus,代码行数:50,
示例22: err_idle_cb/****************************************************************************** ****************************************************************************** ** Async Errors ** ****************************************************************************** ******************************************************************************/static void err_idle_cb(uv_idle_t *idle, int status){ my_uvreq_t *uvr = (my_uvreq_t *)idle; lcb_io_error_cb callback = uvr->cb.err; uv_idle_stop(idle); uv_close((uv_handle_t *)idle, generic_close_cb); if (callback) { callback(&uvr->socket->base); } decref_sock(uvr->socket); (void)status;}
开发者ID:uvenum,项目名称:libcouchbase,代码行数:20,
示例23: fread_idle_cb// Called by the by the 'idle' handle to emulate a reading eventstatic void fread_idle_cb(uv_idle_t *handle){ uv_fs_t req; RStream *rstream = handle->data; rstream->uvbuf.base = rstream->buffer + rstream->wpos; rstream->uvbuf.len = rstream->buffer_size - rstream->wpos; // the offset argument to uv_fs_read is int64_t, could someone really try // to read more than 9 quintillion (9e18) bytes? // DISABLED TO FIX BROKEN BUILD ON 32bit // TODO(elmart): Review types to allow assertion // assert(rstream->fpos <= INT64_MAX); // Synchronous read uv_fs_read( uv_default_loop(), &req, rstream->fd, &rstream->uvbuf, 1, (int64_t) rstream->fpos, NULL); uv_fs_req_cleanup(&req); if (req.result <= 0) { uv_idle_stop(rstream->fread_idle); emit_read_event(rstream, true); return; } // no errors (req.result (ssize_t) is positive), it's safe to cast. size_t nread = (size_t) req.result; rstream->wpos += nread; rstream->fpos += nread; if (rstream->wpos == rstream->buffer_size) { // The last read filled the buffer, stop reading for now rstream_stop(rstream); } emit_read_event(rstream, false);}
开发者ID:ataraxer,项目名称:neovim,代码行数:46,
示例24: fread_idle_cb// Called by the by the 'idle' handle to emulate a reading eventstatic void fread_idle_cb(uv_idle_t *handle){ uv_fs_t req; RStream *rstream = handle->data; rstream->uvbuf.base = rstream->buffer + rstream->wpos; rstream->uvbuf.len = rstream->buffer_size - rstream->wpos; // the offset argument to uv_fs_read is int64_t, could someone really try // to read more than 9 quintillion (9e18) bytes? // upcast is meant to avoid tautological condition warning on 32 bits uintmax_t fpos_intmax = rstream->fpos; assert(fpos_intmax <= INT64_MAX); // Synchronous read uv_fs_read( uv_default_loop(), &req, rstream->fd, &rstream->uvbuf, 1, (int64_t) rstream->fpos, NULL); uv_fs_req_cleanup(&req); if (req.result <= 0) { uv_idle_stop(rstream->fread_idle); emit_read_event(rstream, true); return; } // no errors (req.result (ssize_t) is positive), it's safe to cast. size_t nread = (size_t) req.result; rstream->wpos += nread; rstream->fpos += nread; if (rstream->wpos == rstream->buffer_size) { // The last read filled the buffer, stop reading for now rstream_stop(rstream); } emit_read_event(rstream, false);}
开发者ID:neerajgangwar,项目名称:neovim,代码行数:46,
示例25: uv_closeint uv_close(uv_handle_t* handle) { switch (handle->type) { case UV_TCP: ev_io_stop(EV_DEFAULT_ &handle->write_watcher); ev_io_stop(EV_DEFAULT_ &handle->read_watcher); break; case UV_PREPARE: uv_prepare_stop(handle); break; case UV_CHECK: uv_check_stop(handle); break; case UV_IDLE: uv_idle_stop(handle); break; case UV_ASYNC: ev_async_stop(EV_DEFAULT_ &handle->async_watcher); ev_ref(EV_DEFAULT_UC); break; case UV_TIMER: if (ev_is_active(&handle->timer_watcher)) { ev_ref(EV_DEFAULT_UC); } ev_timer_stop(EV_DEFAULT_ &handle->timer_watcher); break; default: assert(0); return -1; } uv_flag_set(handle, UV_CLOSING); /* This is used to call the on_close callback in the next loop. */ ev_idle_start(EV_DEFAULT_ &handle->next_watcher); ev_feed_event(EV_DEFAULT_ &handle->next_watcher, EV_IDLE); assert(ev_is_pending(&handle->next_watcher)); return 0;}
开发者ID:nekedos,项目名称:node,代码行数:45,
示例26: uv_idle_callbackstatic voiduv_idle_callback(){ SOL_DBG("Entering with state %s", RESOLVE_MAINLOOP_STATE(mainloopState)); if (mainloopState == MAINLOOP_HIJACKING_STARTED) { SOL_DBG("running sol_run()"); mainloopState = MAINLOOP_HIJACKED; sol_run(); SOL_DBG("sol_run() has returned. state is %s", RESOLVE_MAINLOOP_STATE(mainloopState)); if (mainloopState == MAINLOOP_RELEASING_STARTED) { mainloopState = MAINLOOP_RELEASED; } } else if ( mainloopState == MAINLOOP_HIJACKED) { SOL_DBG("main loop already hijacked. Stopping idler"); uv_idle_stop(&uv_idle); }}
开发者ID:Learn-iot,项目名称:soletta,代码行数:18,
示例27: elops_destroy_pt_uvstatic voidelops_destroy_pt_uv(struct lws_context *context, int tsi){ struct lws_context_per_thread *pt = &context->pt[tsi]; int m, ns; lwsl_info("%s: %d/n", __func__, tsi); if (!lws_check_opt(context->options, LWS_SERVER_OPTION_LIBUV)) return; if (!pt->uv.io_loop) return; if (pt->event_loop_destroy_processing_done) return; pt->event_loop_destroy_processing_done = 1; if (!pt->event_loop_foreign) { uv_signal_stop(&pt->w_sigint.uv.watcher); ns = LWS_ARRAY_SIZE(sigs); if (lws_check_opt(context->options, LWS_SERVER_OPTION_UV_NO_SIGSEGV_SIGFPE_SPIN)) ns = 2; for (m = 0; m < ns; m++) { uv_signal_stop(&pt->uv.signals[m]); uv_close((uv_handle_t *)&pt->uv.signals[m], lws_uv_close_cb_sa); } } else lwsl_debug("%s: not closing pt signals/n", __func__); uv_timer_stop(&pt->uv.timeout_watcher); uv_close((uv_handle_t *)&pt->uv.timeout_watcher, lws_uv_close_cb_sa); uv_timer_stop(&pt->uv.hrtimer); uv_close((uv_handle_t *)&pt->uv.hrtimer, lws_uv_close_cb_sa); uv_idle_stop(&pt->uv.idle); uv_close((uv_handle_t *)&pt->uv.idle, lws_uv_close_cb_sa);}
开发者ID:PKRoma,项目名称:libwebsockets,代码行数:43,
注:本文中的uv_idle_stop函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ uv_insert_pending_req函数代码示例 C++ uv_hrtime函数代码示例 |