win: move uv__process_endgames to core.c (#4827)

Refs: https://github.com/libuv/libuv/issues/4819
This commit is contained in:
Ben Noordhuis 2025-07-07 22:08:11 +02:00 committed by GitHub
parent dc117c7dec
commit b36dc711e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 68 additions and 68 deletions

View File

@ -629,6 +629,74 @@ static void uv__process_reqs(uv_loop_t* loop) {
#undef DELEGATE_STREAM_REQ
static void uv__process_endgames(uv_loop_t* loop) {
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(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_close((uv_timer_t*) handle);
uv__handle_close(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_SIGNAL:
uv__signal_endgame(loop, (uv_signal_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;
case UV_FS_POLL:
uv__fs_poll_endgame(loop, (uv_fs_poll_t*) handle);
break;
default:
assert(0);
break;
}
}
}
int uv_run(uv_loop_t *loop, uv_run_mode mode) {
DWORD timeout;

View File

@ -95,74 +95,6 @@ INLINE static void uv__want_endgame(uv_loop_t* loop, uv_handle_t* handle) {
}
INLINE static void uv__process_endgames(uv_loop_t* loop) {
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(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_close((uv_timer_t*) handle);
uv__handle_close(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_SIGNAL:
uv__signal_endgame(loop, (uv_signal_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;
case UV_FS_POLL:
uv__fs_poll_endgame(loop, (uv_fs_poll_t*) handle);
break;
default:
assert(0);
break;
}
}
}
INLINE static HANDLE uv__get_osfhandle(int fd)
{
/* _get_osfhandle() raises an assert in debug builds if the FD is invalid.