static void do_run_loop(my_iops_t *io) { while (uv_run_once(io->loop) && io->do_stop == 0) { /* nothing */ } io->do_stop = 0; }
static void sync_loop_run(struct lcb_io_opt_st *iops) { log_iops_info("=== LOOP: run ==="); IOPS_COOKIE(iops)->do_stop = 0; /** node's libuv does not export uv_run_once */ #ifdef LCB_LUV_VANILLA while (IOPS_COOKIE(iops)->do_stop == 0) { uv_run_once(IOPS_COOKIE(iops)->loop); } #endif /* LCB_LUV_NODEJS */ }
/* * Class: com_iwebpp_libuvpp_handles_LoopHandle * Method: _run * Signature: (JI)I */ extern "C" JNIEXPORT jint JNICALL Java_com_iwebpp_libuvpp_handles_LoopHandle__1run (JNIEnv *env, jobject that, jlong ptr, jint mode) { assert(ptr); ///return uv_run(reinterpret_cast<uv_loop_t*>(ptr), (uv_run_mode) mode); // TBD... porting libuvpp 0.10.x if (mode == 1) return uv_run_once(reinterpret_cast<uv_loop_t*>(ptr)); else return uv_run(reinterpret_cast<uv_loop_t*>(ptr)); }
static void tick_event_loop(lcb_io_opt_t iobase) { my_iops_t *io = (my_iops_t *)iobase; if (!io->startstop_noop) { #if UV_VERSION < 0x000900 uv_run_once(io->loop); io->do_stop = 0; #else uv_run(io->loop, UV_RUN_NOWAIT); #endif } }
///! /// Polls for new events once. Blocking if there is no event pending. /// Returns true if there is no event pending, or false if there are /// more events to be polled. /// Internally, this function just calls uv_run_once() function. /// bool run_once() { return uv_run_once(uv_loop_)==0; }
///! /// Polls for new events once for the default loop. Blocking if there is no event pending. /// Returns true if there is no event pending, or false if there are /// more events to be polled. /// inline bool run_once() { return uv_run_once(uv_default_loop()) == 0; }