示例#1
0
文件: handle.c 项目: philips/libuv
void uv_process_endgames(uv_loop_t* loop) {
    uv_handle_t* handle;

    while (loop->endgame_handles && loop->refs > 0) {
        handle = loop->endgame_handles;
        loop->endgame_handles = handle->endgame_next;

        handle->flags &= ~UV_HANDLE_ENDGAME_QUEUED;

        switch (handle->type) {
        case UV_TCP:
            uv_tcp_endgame(loop, (uv_tcp_t*) handle);
            break;

        case UV_NAMED_PIPE:
            uv_pipe_endgame(loop, (uv_pipe_t*) handle);
            break;

        case UV_TTY:
            uv_tty_endgame(loop, (uv_tty_t*) handle);
            break;

        case UV_UDP:
            uv_udp_endgame(loop, (uv_udp_t*) handle);
            break;

        case UV_POLL:
            uv_poll_endgame(loop, (uv_poll_t*) handle);
            break;

        case UV_TIMER:
            uv_timer_endgame(loop, (uv_timer_t*) handle);
            break;

        case UV_PREPARE:
        case UV_CHECK:
        case UV_IDLE:
            uv_loop_watcher_endgame(loop, handle);
            break;

        case UV_ASYNC:
            uv_async_endgame(loop, (uv_async_t*) handle);
            break;

        case UV_PROCESS:
            uv_process_endgame(loop, (uv_process_t*) handle);
            break;

        case UV_FS_EVENT:
            uv_fs_event_endgame(loop, (uv_fs_event_t*) handle);
            break;

        default:
            assert(0);
            break;
        }
    }
}
示例#2
0
文件: handle.c 项目: dakatsuka/node
void uv_process_endgames() {
  uv_handle_t* handle;

  while (LOOP->endgame_handles) {
    handle = LOOP->endgame_handles;
    LOOP->endgame_handles = handle->endgame_next;

    handle->flags &= ~UV_HANDLE_ENDGAME_QUEUED;

    switch (handle->type) {
      case UV_TCP:
        uv_tcp_endgame((uv_tcp_t*)handle);
        break;

      case UV_NAMED_PIPE:
        uv_pipe_endgame((uv_pipe_t*)handle);
        break;

      case UV_UDP:
        uv_udp_endgame((uv_udp_t*) handle);
        break;

      case UV_TIMER:
        uv_timer_endgame((uv_timer_t*)handle);
        break;

      case UV_PREPARE:
      case UV_CHECK:
      case UV_IDLE:
        uv_loop_watcher_endgame(handle);
        break;

      case UV_ASYNC:
        uv_async_endgame((uv_async_t*)handle);
        break;

      case UV_PROCESS:
        uv_process_endgame((uv_process_t*)handle);
        break;

      default:
        assert(0);
        break;
    }
  }
}