Exemple #1
0
Fichier : loop.c Projet : reid/node
int uv__loop_init(uv_loop_t* loop, int default_loop) {
#if HAVE_KQUEUE
    int flags = EVBACKEND_KQUEUE;
#else
    int flags = EVFLAG_AUTO;
#endif

    memset(loop, 0, sizeof(*loop));

    RB_INIT(&loop->ares_handles);
    RB_INIT(&loop->timer_handles);
    ngx_queue_init(&loop->active_reqs);
    ngx_queue_init(&loop->idle_handles);
    ngx_queue_init(&loop->async_handles);
    ngx_queue_init(&loop->check_handles);
    ngx_queue_init(&loop->prepare_handles);
    ngx_queue_init(&loop->handle_queue);
    loop->closing_handles = NULL;
    loop->channel = NULL;
    loop->time = uv_hrtime() / 1000000;
    loop->async_pipefd[0] = -1;
    loop->async_pipefd[1] = -1;
    loop->ev = (default_loop ? ev_default_loop : ev_loop_new)(flags);
    ev_set_userdata(loop->ev, loop);
    eio_channel_init(&loop->uv_eio_channel, loop);

#if __linux__
    RB_INIT(&loop->inotify_watchers);
    loop->inotify_fd = -1;
#endif
#if HAVE_PORTS_FS
    loop->fs_fd = -1;
#endif
    return 0;
}
Exemple #2
0
static int uv__loop_init(uv_loop_t* loop,
                         struct ev_loop *(ev_loop_new)(unsigned int flags)) {
  memset(loop, 0, sizeof(*loop));
#if HAVE_KQUEUE
  loop->ev = ev_loop_new(EVBACKEND_KQUEUE);
#else
  loop->ev = ev_loop_new(EVFLAG_AUTO);
#endif
  ev_set_userdata(loop->ev, loop);
  eio_channel_init(&loop->uv_eio_channel, loop);
  return 0;
}
Exemple #3
0
int uv__loop_init(uv_loop_t* loop, int default_loop) {
#if HAVE_KQUEUE
  int flags = EVBACKEND_KQUEUE;
#else
  int flags = EVFLAG_AUTO;
#endif
  memset(loop, 0, sizeof(*loop));
  RB_INIT(&loop->uv_ares_handles_);
  loop->endgame_handles = NULL;
  loop->channel = NULL;
  loop->ev = (default_loop ? ev_default_loop : ev_loop_new)(flags);
  ev_set_userdata(loop->ev, loop);
  eio_channel_init(&loop->uv_eio_channel, loop);
#if __linux__
  RB_INIT(&loop->inotify_watchers);
  loop->inotify_fd = -1;
#endif
#if HAVE_PORTS_FS
  loop->fs_fd = -1;
#endif
  return 0;
}