Example #1
0
static int uv__run(uv_loop_t* loop) {
  uv__run_idle(loop);
  uv__run_pending(loop);

  if (uv__has_active_handles(loop) || uv__has_active_reqs(loop)) {
    uv__run_prepare(loop);
    /* Need to poll even if there are no active handles left, otherwise
     * uv_work_t reqs won't complete...
     */
    uv__poll(loop, uv__should_block(loop));
    uv__run_check(loop);
  }

  return uv__has_pending_handles(loop)
      || uv__has_active_handles(loop)
      || uv__has_active_reqs(loop);
}
Example #2
0
static int uv__run(uv_loop_t* loop) {
  uv_update_time(loop);
  uv__run_timers(loop);
  uv__run_idle(loop);
  uv__run_prepare(loop);
  uv__poll(loop);
  uv__run_check(loop);
  uv__run_closing_handles(loop);
  return uv__has_active_handles(loop) || uv__has_active_reqs(loop);
}
Example #3
0
int uv_backend_timeout(const uv_loop_t* loop) {
  if (!uv__has_active_handles(loop) && !uv__has_active_reqs(loop))
    return 0;

  if (!ngx_queue_empty(&loop->idle_handles))
    return 0;

  if (loop->closing_handles)
    return 0;

  return uv__next_timeout(loop);
}
Example #4
0
static unsigned int uv__poll_timeout(uv_loop_t* loop) {
  if (!uv__has_active_handles(loop))
    return 0;

  if (!ngx_queue_empty(&loop->idle_handles))
    return 0;

  if (loop->closing_handles)
    return 0;

  return uv__next_timeout(loop);
}
Example #5
0
File: core.c Project: gamemake/sail
int uv_backend_timeout(const uv_loop_t* loop) {
  if (loop->stop_flag != 0)
    return 0;

  if (!uv__has_active_handles(loop) && !uv__has_active_reqs(loop))
    return 0;

  if (!QUEUE_EMPTY(&loop->idle_handles))
    return 0;

  if (loop->closing_handles)
    return 0;

  return uv__next_timeout(loop);
}
Example #6
0
File: core.c Project: kjthegod/node
int uv_backend_timeout(const uv_loop_t* loop) {
  if (loop->stop_flag != 0)
    return 0;

  if (!uv__has_active_handles(loop) && !uv__has_active_reqs(loop))
    return 0;

  if (loop->pending_reqs_tail)
    return 0;

  if (loop->endgame_handles)
    return 0;

  if (loop->idle_handles)
    return 0;

  return uv__next_timeout(loop);
}
Example #7
0
static int uv__loop_alive(const uv_loop_t* loop) {
  return uv__has_active_handles(loop) ||
         uv__has_active_reqs(loop) ||
         loop->closing_handles != NULL;
}