这篇教程C++ uv_loop_init函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uv_loop_init函数的典型用法代码示例。如果您正苦于以下问题:C++ uv_loop_init函数的具体用法?C++ uv_loop_init怎么用?C++ uv_loop_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uv_loop_init函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _connected UDPClient::UDPClient() : _connected(false) { uv_loop_init(&loop); uv_udp_init(&loop, &client); uv_udp_init(&loop, &server); server.data = this; client.data = this; }
开发者ID:zeitoonco,项目名称:zds,代码行数:9,
示例2: UV_CHECK ThreadPool::ThreadPool() { loop_ = (uv_loop_t*)malloc(sizeof *loop_); UV_CHECK(uv_loop_init(loop_)); UV_CHECK(uv_async_init(loop_, &async_, thread_pool_async_cb)); async_.data = (void*)(this); thread_.reset(new thread([=] () { UV_CHECK(uv_run(loop_, UV_RUN_DEFAULT)); })); }
开发者ID:zhxfl,项目名称:purine2,代码行数:9,
示例3: MVM_tc_create/* Initializes a new thread context. Note that this doesn't set up a * thread itself, it just creates the data structure that exists in * MoarVM per thread. */MVMThreadContext * MVM_tc_create(MVMThreadContext *parent, MVMInstance *instance) { MVMThreadContext *tc = MVM_calloc(1, sizeof(MVMThreadContext)); /* Associate with VM instance. */ tc->instance = instance; /* Use default loop for main thread; create a new one for others. */ if (instance->main_thread) { int r; tc->loop = MVM_calloc(1, sizeof(uv_loop_t)); r = uv_loop_init(tc->loop); if (r < 0) { MVM_free(tc->loop); MVM_free(tc); MVM_exception_throw_adhoc(parent, "Could not create a new Thread: %s", uv_strerror(r)); } } else { tc->loop = uv_default_loop(); } /* Set up GC nursery. We only allocate tospace initially, and allocate * fromspace the first time this thread GCs, provided it ever does. */ tc->nursery_tospace = MVM_calloc(1, MVM_NURSERY_SIZE); tc->nursery_alloc = tc->nursery_tospace; tc->nursery_alloc_limit = (char *)tc->nursery_alloc + MVM_NURSERY_SIZE; /* Set up temporary root handling. */ tc->num_temproots = 0; tc->alloc_temproots = MVM_TEMP_ROOT_BASE_ALLOC; tc->temproots = MVM_malloc(sizeof(MVMCollectable **) * tc->alloc_temproots); /* Set up intergenerational root handling. */ tc->num_gen2roots = 0; tc->alloc_gen2roots = 64; tc->gen2roots = MVM_malloc(sizeof(MVMCollectable *) * tc->alloc_gen2roots); /* Set up the second generation allocator. */ tc->gen2 = MVM_gc_gen2_create(instance); /* Allocate an initial call stack region for the thread. */ MVM_callstack_region_init(tc); /* Initialize random number generator state. */ MVM_proc_seed(tc, (MVM_platform_now() / 10000) * MVM_proc_getpid(tc)); /* Initialize frame sequence numbers */ tc->next_frame_nr = 0; tc->current_frame_nr = 0; /* Initialize last_payload, so we can be sure it's never NULL and don't * need to check. */ tc->last_payload = instance->VMNull; return tc;}
开发者ID:niner,项目名称:MoarVM,代码行数:59,
示例4: uv_loop_inituv_loop_t *get_loop(){ if (loop == NULL) { loop = (uv_loop_t *)malloc(sizeof(uv_loop_t)); uv_loop_init(loop); } return loop;}
开发者ID:lqkaixin,项目名称:chart,代码行数:10,
示例5: uv_loop_init ESDClient::ESDClient(std::string nodeID, std::string transactionID){ this->nodeID = nodeID; this->transactionID = transactionID; this->krpc = std::unique_ptr<ESDKrpc>(new ESDKrpc); loop = new uv_loop_t; uv_loop_init(loop); this->udp = std::unique_ptr<ESDUdp>(new ESDUdp(loop)); key = krpc->generateNodeID(NODE_ID_LENGTH); }
开发者ID:zhaishuai,项目名称:EyeOfSauronDHTMonitor,代码行数:10,
示例6: uv_initvoid uv_init() { /* Initialize winsock */ uv_winsock_init(); /* Fetch winapi function pointers */ uv_winapi_init(); /* Intialize event loop */ uv_loop_init();}
开发者ID:FugueNation,项目名称:node,代码行数:10,
示例7: async_initint async_init(void) { int rc = uv_loop_init(async_loop); if(rc < 0) return rc; master->fiber = co_active(); master->flags = 0; active = master; async_main = master; trampoline = co_create(STACK_DEFAULT, trampoline_fn); if(!trampoline) return UV_ENOMEM; return 0;}
开发者ID:Ryezhang,项目名称:stronglink,代码行数:11,
示例8: thread_id_EventServer::EventServer() : thread_id_(std::this_thread::get_id()){ CHECK_EQ(0, uv_loop_init(&uv_loop_)); async_handle_ = new AsyncHandle; async_handle_->es = this; async_handle_->uv_handle.data = async_handle_; CHECK_EQ(0, uv_async_init(&uv_loop_, &async_handle_->uv_handle, &EventServer::uv_async_cb));}
开发者ID:qiqjiao,项目名称:webcrawl,代码行数:11,
示例9: mainint main(){ uv_loop_t *loop = (uv_loop_t*)malloc(sizeof(uv_loop_t)); uv_loop_init(loop); printf("Now quitting./n"); uv_run(loop, UV_RUN_DEFAULT); uv_loop_close(loop); free(loop); return 0;}
开发者ID:kasicass,项目名称:kasicass,代码行数:12,
示例10: device_ Loop::Loop(int device) : device_(device), stop_(false) { loop_ = (uv_loop_t*)malloc(sizeof *loop_); UV_CHECK(uv_loop_init(loop_)); UV_CHECK(uv_async_init(loop_, &async_, async_cb)); async_.data = (void*)(this); thread_.reset(new thread([=] () { if (device_ >= 0) { THREAD_SET_CUDA_DEVICE(device); } UV_CHECK(uv_run(loop_, UV_RUN_DEFAULT)); })); }
开发者ID:zhxfl,项目名称:purine2,代码行数:12,
示例11: mainint main() { uv_loop_t* loop = uv_default_loop(); uv_loop_init(loop); uv_timer_t timer; uv_timer_init(loop, &timer); uv_timer_start(&timer, timer_callback, 0, 1000); uv_run(loop, UV_RUN_DEFAULT); uv_loop_close(loop); return 0;}
开发者ID:danbev,项目名称:learning-libuv,代码行数:13,
示例12: event_initvoid event_init(void){ log_msg("INIT", "event"); uv_loop_init(eventloop()); uv_prepare_init(eventloop(), &mainloop()->event_prepare); uv_timer_init(eventloop(), &mainloop()->children_kill_timer); uv_signal_init(eventloop(), &mainloop()->children_watcher); SLIST_INIT(&mainloop()->children); eventloop()->data = eventloop(); QUEUE_INIT(&eventq()->headtail); QUEUE_INIT(&drawq()->headtail); mainloop()->running = false;}
开发者ID:jollywho,项目名称:nav,代码行数:13,
示例13: ipc_send_recv_helper_threadprocvoid ipc_send_recv_helper_threadproc(void* arg) { int r; uv_loop_t loop; r = uv_loop_init(&loop); ASSERT(r == 0); r = run_ipc_send_recv_helper(&loop, 1); ASSERT(r == 0); r = uv_loop_close(&loop); ASSERT(r == 0);}
开发者ID:CurlyMoo,项目名称:libuv,代码行数:13,
示例14: CASE_TESTCASE_TEST(atbus_endpoint, get_connection){ atbus::node::conf_t conf; atbus::node::default_conf(&conf); conf.children_mask = 16; uv_loop_t ev_loop; uv_loop_init(&ev_loop); conf.ev_loop = &ev_loop; conf.recv_buffer_size = 64 * 1024; char* buffer = new char[conf.recv_buffer_size]; memset(buffer, -1, sizeof(conf.recv_buffer_size)); // init it and then valgrind will now report uninitialised used char addr[32] = { 0 }; UTIL_STRFUNC_SNPRINTF(addr, sizeof(addr), "mem://0x%p", buffer); if (addr[8] == '0' && addr[9] == 'x') { memset(addr, 0, sizeof(addr)); UTIL_STRFUNC_SNPRINTF(addr, sizeof(addr), "mem://%p", buffer); } // 排除未完成连接 { atbus::node::ptr_t node = atbus::node::create(); node->init(0x12345678, &conf); atbus::connection::ptr_t conn1 = atbus::connection::create(node.get()); CASE_EXPECT_EQ(0, conn1->connect(addr)); atbus::connection::ptr_t conn2 = atbus::connection::create(node.get()); conn2->connect("ipv4://127.0.0.1:80"); atbus::endpoint::ptr_t ep = atbus::endpoint::create(node.get(), 0x12345679, 8, node->get_pid(), node->get_hostname()); CASE_EXPECT_TRUE(ep->add_connection(conn1.get(), false)); CASE_EXPECT_TRUE(ep->add_connection(conn2.get(), false)); CASE_EXPECT_EQ(0, node->add_endpoint(ep)); atbus::connection* conn3 = node->get_self_endpoint()->get_data_connection(ep.get()); CASE_EXPECT_EQ(conn3, conn1.get()); } while (UV_EBUSY == uv_loop_close(&ev_loop)) { uv_run(&ev_loop, UV_RUN_ONCE); } delete []buffer;}
开发者ID:gitter-badger,项目名称:libatbus,代码行数:50,
示例15: uv_initstatic int uv_init(void){ int ret = 0; ret = uv_loop_init(&g_loop); ret = uv_timer_init(&g_loop, &g_timer); //uv_ref((uv_handle_t*)&g_timer); ret = uv_timer_start(&g_timer, timer_fn, 10, 10); ret = uv_thread_create(&g_loop_thread, loop_thread, NULL); css_logger_init(&g_loop); g_sys = new CCaptureSys(&g_loop); //g_remote = new CRemoteSys(&g_loop); //g_sys->m_msgsock.set_loop(&g_loop); return ret;}
开发者ID:zhifeichen,项目名称:libcapture,代码行数:14,
示例16: mainint main(int argc, char **argv){ h2o_hostconf_t *hostconf; signal(SIGPIPE, SIG_IGN); h2o_config_init(&config); hostconf = h2o_config_register_host(&config, "default"); register_handler(hostconf, "/post-test", post_test); register_handler(hostconf, "/chunked-test", chunked_test); h2o_file_register(h2o_config_register_path(hostconf, "/"), "examples/doc_root", NULL, NULL, 0);#if 0 /* reproxy is not yet implemented */ register_handler(hostconf, "/reproxy-test", reproxy_test); h2o_reproxy_register(hostconf);#endif#if H2O_USE_LIBUV uv_loop_t loop; uv_loop_init(&loop); h2o_context_init(&ctx, &loop, &config);#else h2o_context_init(&ctx, h2o_evloop_create(), &config);#endif /* disabled by default: uncomment the block below to use HTTPS instead of HTTP */ /* if (setup_ssl("server.crt", "server.key") != 0) goto Error; */ /* disabled by default: uncomment the line below to enable access logging */ /* h2o_access_log_register(&config.default_host, "/dev/stdout", NULL); */ if (create_listener() != 0) { fprintf(stderr, "failed to listen to 127.0.0.1:7890:%s/n", strerror(errno)); goto Error; }#if H2O_USE_LIBUV uv_run(ctx.loop, UV_RUN_DEFAULT);#else while (h2o_evloop_run(ctx.loop) == 0) ;#endifError: return 1;}
开发者ID:zhangjinde,项目名称:h2o,代码行数:49,
示例17: _do_fork_fs_events_childstatic int _do_fork_fs_events_child(int file_or_dir) { /* basic fsevents work in the child after a fork */ pid_t child_pid; uv_loop_t loop; /* Watch in the parent, prime the loop and/or threads. */ assert_watch_file_current_dir(uv_default_loop(), file_or_dir); child_pid = fork(); ASSERT(child_pid != -1); if (child_pid != 0) { /* parent */ assert_wait_child(child_pid); } else { /* child */ /* Ee can watch in a new loop, but dirs only work if we're on linux. */#if defined(__APPLE__) file_or_dir = FS_TEST_FILE;#endif printf("Running child/n"); uv_loop_init(&loop); printf("Child first watch/n"); assert_watch_file_current_dir(&loop, file_or_dir); ASSERT(0 == uv_loop_close(&loop)); printf("Child second watch default loop/n"); /* Ee can watch in the default loop. */ ASSERT(0 == uv_loop_fork(uv_default_loop())); /* On some platforms (OS X), if we don't update the time now, * the timer cb fires before the event loop enters uv__io_poll, * instead of after, meaning we don't see the change! This may be * a general race. */ uv_update_time(uv_default_loop()); assert_watch_file_current_dir(uv_default_loop(), file_or_dir); /* We can close the parent loop successfully too. This is especially important on Apple platforms where if we're not careful trying to touch the CFRunLoop, even just to shut it down, that we allocated in the FS_TEST_DIR case would crash. */ ASSERT(0 == uv_loop_close(uv_default_loop())); printf("Exiting child /n"); } MAKE_VALGRIND_HAPPY(); return 0;}
开发者ID:AlexanderPankiv,项目名称:node,代码行数:49,
示例18: stream_set_blocking/// Sets the stream associated with `fd` to "blocking" mode.////// @return `0` on success, or `-errno` on failure.int stream_set_blocking(int fd, bool blocking){ // Private loop to avoid conflict with existing watcher(s): // uv__io_stop: Assertion `loop->watchers[w->fd] == w' failed. uv_loop_t loop; uv_pipe_t stream; uv_loop_init(&loop); uv_pipe_init(&loop, &stream, 0); uv_pipe_open(&stream, fd); int retval = uv_stream_set_blocking((uv_stream_t *)&stream, blocking); uv_close((uv_handle_t *)&stream, NULL); uv_run(&loop, UV_RUN_NOWAIT); // not necessary, but couldn't hurt. uv_loop_close(&loop); return retval;}
开发者ID:lucc,项目名称:neovim,代码行数:18,
示例19: init int init() { int rc = 0;#if UV_VERSION_MAJOR > 0 rc = uv_loop_init(&loop_); if (rc != 0) return rc; is_loop_initialized_ = true;#endif#if !defined(_WIN32) rc = uv_signal_init(loop(), &sigpipe_); if (rc != 0) return rc; rc = uv_signal_start(&sigpipe_, on_signal, SIGPIPE);#endif return rc; }
开发者ID:Instagram,项目名称:cpp-driver,代码行数:15,
示例20: uv_loop_newuv_loop_t* uv_loop_new(void) { uv_loop_t* loop; /* Initialize libuv itself first */ uv_once(&uv_init_guard_, uv_init); loop = (uv_loop_t*)malloc(sizeof(uv_loop_t)); if (!loop) { uv_fatal_error(ERROR_OUTOFMEMORY, "malloc"); } uv_loop_init(loop); return loop;}
开发者ID:cduran,项目名称:dnscrypt-proxy,代码行数:15,
示例21: uv_loop_inituv_loop_t* ThreadManager::initTask(const std::string& name) { Task& task = task_map[name]; uv_loop_t* loop; if (adaptor) { loop = &adaptor->main_loop; } else { task.loop = new uv_loop_t; uv_loop_init(task.loop); loop = task.loop; } uv_async_init(loop, &task.cleanup, cleanup_func); task.cleanup.data = &task; return loop;}
开发者ID:mhrobinson,项目名称:opflex,代码行数:16,
示例22: loop_initvoid loop_init(Loop *loop, void *data){ uv_loop_init(&loop->uv); loop->recursive = 0; loop->uv.data = loop; loop->children = kl_init(WatcherPtr); loop->children_stop_requests = 0; loop->events = multiqueue_new_parent(loop_on_put, loop); loop->fast_events = multiqueue_new_child(loop->events); loop->thread_events = multiqueue_new_parent(NULL, NULL); uv_mutex_init(&loop->mutex); uv_async_init(&loop->uv, &loop->async, async_cb); uv_signal_init(&loop->uv, &loop->children_watcher); uv_timer_init(&loop->uv, &loop->children_kill_timer); uv_timer_init(&loop->uv, &loop->poll_timer);}
开发者ID:fatbird,项目名称:neovim,代码行数:16,
示例23: sg_etp_session_opensg_etp_session_t * sg_etp_session_open(IUINT32 conv, const struct sockaddr * addr, uv_loop_t * loop, void * data){ sg_etp_session_t * session = NULL; do { session = (sg_etp_session_t *)malloc(sizeof(sg_etp_session_t)); SG_ASSERT_BRK(NULL != session, "create client failed"); memset(session, 0, sizeof(sg_etp_session_t)); session->data = data; session->conv = conv; memcpy(&(session->addr), addr, sizeof(struct sockaddr)); if (NULL == loop) /* self-contained loop, for client */ { session->loop = &(session->loop_hdl); uv_loop_init(session->loop); } else { session->loop = loop; } /* create the kcp object */ session->kcp = ikcp_create(session->conv, (void*)session); SG_ASSERT_BRK(NULL != session->kcp, "create ikcp failed"); session->kcp->output = on_kcp_output; session->timeout = SG_ETP_SESSION_TIMEOUT; session->recv_data_time = uv_now(session->loop) + session->timeout; return session; } while (0); if (NULL != session) { free(session); session = NULL; } return session;}
开发者ID:canmor-lam,项目名称:libsg,代码行数:46,
示例24: lws_uv_initloopLWS_VISIBLE intlws_uv_initloop(struct lws_context *context, uv_loop_t *loop, int tsi){ struct lws_context_per_thread *pt = &context->pt[tsi]; struct lws *wsi = wsi_from_fd(context, pt->lserv_fd); int status = 0, n; if (!loop) { loop = lws_malloc(sizeof(*loop)); uv_loop_init(loop); pt->ev_loop_foreign = 0; } else pt->ev_loop_foreign = 1; pt->io_loop_uv = loop; if (pt->context->use_ev_sigint) { assert(ARRAY_SIZE(sigs) <= ARRAY_SIZE(pt->signals)); for (n = 0; n < ARRAY_SIZE(sigs); n++) { uv_signal_init(loop, &pt->signals[n]); pt->signals[n].data = pt->context; uv_signal_start(&pt->signals[n], context->lws_uv_sigint_cb, sigs[n]); } } /* * Initialize the accept wsi read watcher with the listening socket * and register a callback for read operations * * We have to do it here because the uv loop(s) are not * initialized until after context creation. */ if (wsi) { wsi->w_read.context = context; uv_poll_init(pt->io_loop_uv, &wsi->w_read.uv_watcher, pt->lserv_fd); uv_poll_start(&wsi->w_read.uv_watcher, UV_READABLE, lws_io_cb); } uv_timer_init(pt->io_loop_uv, &pt->uv_timeout_watcher); uv_timer_start(&pt->uv_timeout_watcher, lws_uv_timeout_cb, 1000, 1000); return status;}
开发者ID:dosvald,项目名称:libwebsockets,代码行数:45,
示例25: read_cbstatic void read_cb(uv_stream_t *stream, ssize_t cnt, const uv_buf_t *buf){ if (cnt <= 0) { uv_read_stop(stream); return; } int *interrupted = stream->data; for (int i = 0; i < cnt; i++) { if (buf->base[i] == CTRL_C) { (*interrupted)++; } } uv_loop_t write_loop; uv_loop_init(&write_loop); uv_tty_t out; uv_tty_init(&write_loop, &out, fileno(stdout), 0); uv_write_t req; uv_buf_t b = { .base = buf->base,#ifdef WIN32 .len = (ULONG)cnt#else .len = (size_t)cnt#endif }; uv_write(&req, STRUCT_CAST(uv_stream_t, &out), &b, 1, NULL); uv_run(&write_loop, UV_RUN_DEFAULT); uv_close(STRUCT_CAST(uv_handle_t, &out), NULL); uv_run(&write_loop, UV_RUN_DEFAULT); if (uv_loop_close(&write_loop)) { abort(); } free(buf->base); if (*interrupted >= 2) { uv_walk(uv_default_loop(), walk_cb, NULL); } else if (*interrupted == 1) { fprintf(stderr, "interrupt received, press again to exit/n"); }}
开发者ID:ZyX-I,项目名称:neovim,代码行数:45,
示例26: initVMstatic void initVM(){ WrenConfiguration config; wrenInitConfiguration(&config); config.bindForeignMethodFn = bindForeignMethod; config.bindForeignClassFn = bindForeignClass; config.loadModuleFn = readModule; config.writeFn = write; // Since we're running in a standalone process, be generous with memory. config.initialHeapSize = 1024 * 1024 * 100; vm = wrenNewVM(&config); // Initialize the event loop. loop = (uv_loop_t*)malloc(sizeof(uv_loop_t)); uv_loop_init(loop);}
开发者ID:0x73,项目名称:wren,代码行数:18,
示例27: uv_setup_argsvoid rtScriptDuk::init2(int argc, char** argv)#endif{ // Hack around with the argv pointer. Used for process.title = "blah".#ifdef ENABLE_DEBUG_MODE g_argvduk = uv_setup_args(g_argcduk, g_argvduk);#else argv = uv_setup_args(argc, argv);#endif rtLogInfo(__FUNCTION__);#if 0#warning Using DEBUG AGENT... use_debug_agent = true; // JUNK#endif if(duk_is_initialized == false) { duk_is_initialized = true; uv_loop_t *dukLoop = new uv_loop_t(); uv_loop_init(dukLoop); //uv_loop_t dukLoop = uv_default_loop(); dukCtx = duk_create_heap(NULL, NULL, NULL, dukLoop, NULL); if (!dukCtx) { rtLogWarn("Problem initiailizing duktape heap/n"); return; } dukLoop->data = dukCtx; uvLoops.push_back(dukLoop); { duk_push_thread_stash(dukCtx, dukCtx); duk_push_pointer(dukCtx, (void*)dukLoop); duk_bool_t rc = duk_put_prop_string(dukCtx, -2, "__duk_loop"); assert(rc); duk_pop(dukCtx); } rtScriptDukUtils::rtSetupJsModuleBindings(dukCtx); }}
开发者ID:madanagopalt,项目名称:pxCore,代码行数:44,
示例28: nub_loop_initvoid nub_loop_init(nub_loop_t* loop) { uv_async_t* async_handle; int er; er = uv_loop_init(&loop->uvloop); ASSERT(0 == er); er = uv_prepare_init(&loop->uvloop, &loop->queue_processor_); ASSERT(0 == er); loop->queue_processor_.data = loop; uv_unref((uv_handle_t*) &loop->queue_processor_); er = uv_mutex_init(&loop->queue_processor_lock_); ASSERT(0 == er); fuq_init(&loop->blocking_queue_); er = uv_sem_init(&loop->loop_lock_sem_, 0); ASSERT(0 == er); fuq_init(&loop->thread_dispose_queue_); er = uv_mutex_init(&loop->thread_dispose_lock_); ASSERT(0 == er); fuq_init(&loop->work_queue_); er = uv_mutex_init(&loop->work_lock_); ASSERT(0 == er); async_handle = (uv_async_t*) malloc(sizeof(*async_handle)); CHECK_NE(NULL, async_handle); er = uv_async_init(&loop->uvloop, async_handle, nub__thread_dispose); ASSERT(0 == er); async_handle->data = loop; loop->work_ping_ = async_handle; uv_unref((uv_handle_t*) loop->work_ping_); loop->ref_ = 0; loop->disposed_ = 0; er = uv_prepare_start(&loop->queue_processor_, nub__async_prepare_cb); ASSERT(0 == er);}
开发者ID:nubjs,项目名称:libnub,代码行数:44,
示例29: mainint main(int argc, char **argv){ h2o_hostconf_t *hostconf; h2o_pathconf_t *pathconf; h2o_config_init(&config); hostconf = h2o_config_register_host(&config, h2o_iovec_init(H2O_STRLIT("default")), 65535); pathconf = h2o_config_register_path(hostconf, "/", 0); h2o_create_handler(pathconf, sizeof(h2o_handler_t))->on_req = on_req;#if H2O_USE_LIBUV uv_loop_t loop; uv_loop_init(&loop); h2o_context_init(&ctx, &loop, &config);#else h2o_context_init(&ctx, h2o_evloop_create(), &config);#endif /* disabled by default: uncomment the block below to use HTTPS instead of HTTP */ /* if (setup_ssl("server.crt", "server.key") != 0) goto Error; */ accept_ctx.ctx = &ctx; accept_ctx.hosts = config.hosts; if (create_listener() != 0) { fprintf(stderr, "failed to listen to 127.0.0.1:7890:%s/n", strerror(errno)); goto Error; }#if H2O_USE_LIBUV uv_run(ctx.loop, UV_RUN_DEFAULT);#else while (h2o_evloop_run(ctx.loop, INT32_MAX) == 0) ;#endifError: return 1;}
开发者ID:fetus-hina,项目名称:h2o,代码行数:42,
示例30: foreign_event_loop_init_and_run_libuvstatic voidforeign_event_loop_init_and_run_libuv(void){ /* we create and start our "foreign loop" */#if (UV_VERSION_MAJOR > 0) // Travis... uv_loop_init(&loop_uv);#endif uv_signal_init(&loop_uv, &sighandler_uv); uv_signal_start(&sighandler_uv, signal_cb_uv, SIGINT); uv_timer_init(&loop_uv, &timer_outer_uv);#if (UV_VERSION_MAJOR > 0) // Travis... uv_timer_start(&timer_outer_uv, timer_cb_uv, 0, 1000);#else (void)timer_cb_uv;#endif uv_run(&loop_uv, UV_RUN_DEFAULT);}
开发者ID:ABruines,项目名称:libwebsockets,代码行数:20,
注:本文中的uv_loop_init函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ uv_mutex_init函数代码示例 C++ uv_loop_close函数代码示例 |