mirror of
https://github.com/curl/curl.git
synced 2026-08-26 05:13:31 +03:00
select: use poll() if existing, avoid poll() with no sockets
poll() on macOS 10.12 was deemed broken in 2016 when we discovered that it misbehaves when provided with no sockets to wait for. The HAVE_POLL_FINE is used to mark a poll() implementation that behaves correctly: it *should* still wait the timeout time. curl has therefore opted to use select() on Apple operating systems ever since. To avoid the risk that this or other breakage cause problems. However, using select() internally is also bad because it suffers from problems when using file descriptors beyond 1024. This change makes poll() used if it is present, but if there is no sockets to wait for it avoids using poll() and instead falls back to select() - but without any sockets to wait for there is no 1024 problem. This removes all previous special-handling involving HAVE_POLL_FINE. ref: https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/ Closes #15096
This commit is contained in:
parent
72d2090fc2
commit
c72cefea0f
12 changed files with 42 additions and 165 deletions
|
|
@ -49,8 +49,6 @@ void tool_go_sleep(long ms)
|
|||
delay(ms);
|
||||
#elif defined(_WIN32)
|
||||
Sleep((DWORD)ms);
|
||||
#elif defined(HAVE_POLL_FINE)
|
||||
(void)poll((void *)0, 0, (int)ms);
|
||||
#else
|
||||
struct timeval timeout;
|
||||
timeout.tv_sec = ms / 1000L;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue