未验证 提交 3ad696ce 编写于 作者: T Thays Grazia 提交者: GitHub

[mono][debugger] Do not use `select(2)` on debugger-agent (#90293)

* Do not use select on debugger-agent

* use pool on APPLE os
上级 57e08256
...@@ -85,6 +85,7 @@ ...@@ -85,6 +85,7 @@
#include <mono/utils/w32api.h> #include <mono/utils/w32api.h>
#include <mono/utils/mono-logger-internals.h> #include <mono/utils/mono-logger-internals.h>
#include <mono/utils/mono-proclib.h> #include <mono/utils/mono-proclib.h>
#include <mono/utils/mono-poll.h>
#include <mono/component/debugger-state-machine.h> #include <mono/component/debugger-state-machine.h>
#include "debugger-agent.h" #include "debugger-agent.h"
...@@ -1144,16 +1145,10 @@ socket_transport_connect (const char *address) ...@@ -1144,16 +1145,10 @@ socket_transport_connect (const char *address)
PRINT_DEBUG_MSG (1, "Listening on %s:%d (timeout=%d ms)...\n", host, port, agent_config.timeout); PRINT_DEBUG_MSG (1, "Listening on %s:%d (timeout=%d ms)...\n", host, port, agent_config.timeout);
if (agent_config.timeout) { if (agent_config.timeout) {
fd_set readfds; mono_pollfd mp;
struct timeval tv; mp.fd = (int)sfd;
mp.events = MONO_POLLIN;
tv.tv_sec = 0; res = mono_poll (&mp, 1, agent_config.timeout);
tv.tv_usec = agent_config.timeout * 1000;
FD_ZERO (&readfds);
FD_SET (sfd, &readfds);
res = select ((int)sfd + 1, &readfds, NULL, NULL, &tv);
if (res == 0) { if (res == 0) {
PRINT_ERROR_MSG ("debugger-agent: Timed out waiting to connect.\n"); PRINT_ERROR_MSG ("debugger-agent: Timed out waiting to connect.\n");
exit (1); exit (1);
......
...@@ -31,7 +31,7 @@ mono_poll (mono_pollfd *ufds, unsigned int nfds, int timeout) ...@@ -31,7 +31,7 @@ mono_poll (mono_pollfd *ufds, unsigned int nfds, int timeout)
#else #else
#if defined(HAVE_POLL) && !defined(__APPLE__) #if defined(HAVE_POLL)
int int
mono_poll_can_add (mono_pollfd *ufds, unsigned int nfds, int fd) mono_poll_can_add (mono_pollfd *ufds, unsigned int nfds, int fd)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册