mirror of
https://github.com/ruby/ruby.git
synced 2026-11-08 01:20:26 +08:00
Notify the hostname resolution through a pipe on Windows as well
rb_w32_select_with_thread() polls the read end of a pipe, so the resolution threads can report through one there too. The waiter goes through nonblock_set() because the Windows fcntl() has no F_GETFL. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
6c342f179b
commit
f902d4822d
Notes:
git
2026-11-06 01:45:10 +00:00
@ -528,6 +528,10 @@ pick_addrinfo(struct hostname_resolution_store *resolution_store, int last_famil
|
||||
return selected_ai;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#define pipe(fds) rb_w32_pipe(fds)
|
||||
#endif
|
||||
|
||||
static void
|
||||
nonblock_set(int fd, int nonblock)
|
||||
{
|
||||
@ -670,11 +674,7 @@ init_fast_fallback_inetsock_internal(VALUE v)
|
||||
} else {
|
||||
if (pipe(pipefd) != 0) rb_syserr_fail(errno, "pipe(2)");
|
||||
hostname_resolution_waiter = pipefd[0];
|
||||
int waiter_flags = fcntl(hostname_resolution_waiter, F_GETFL, 0);
|
||||
if (waiter_flags < 0) rb_syserr_fail(errno, "fcntl(2)");
|
||||
if ((fcntl(hostname_resolution_waiter, F_SETFL, waiter_flags | O_NONBLOCK)) < 0) {
|
||||
rb_syserr_fail(errno, "fcntl(2)");
|
||||
}
|
||||
nonblock_set(hostname_resolution_waiter, true);
|
||||
arg->wait = hostname_resolution_waiter;
|
||||
hostname_resolution_notifier = pipefd[1];
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user