Skip to content

Commit cf6f4b3

Browse files
committed
cli: Convert to php_pollfd_for_ms from select
This is not a poll call, but it is functionally the same as one; convert it to the single fd polling function which is clearer to read.
1 parent 0c67aa2 commit cf6f4b3

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

sapi/cli/php_cli.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@
7878
#include "php_cli_process_title.h"
7979
#include "php_cli_process_title_arginfo.h"
8080

81-
#ifndef PHP_WIN32
82-
# define php_select(m, r, w, e, t) select(m, r, w, e, t)
83-
#else
84-
# include "win32/select.h"
85-
#endif
86-
8781
#if defined(PHP_WIN32) && defined(HAVE_OPENSSL_EXT)
8882
# include "openssl/applink.c"
8983
#endif
@@ -218,20 +212,8 @@ static void print_extensions(void) /* {{{ */
218212
#ifdef PHP_WRITE_STDOUT
219213
static inline bool sapi_cli_select(php_socket_t fd)
220214
{
221-
fd_set wfd;
222-
struct timeval tv;
223-
int ret;
224-
225-
FD_ZERO(&wfd);
226-
227-
PHP_SAFE_FD_SET(fd, &wfd);
228-
229-
tv.tv_sec = (long)FG(default_socket_timeout);
230-
tv.tv_usec = 0;
231-
232-
ret = php_select(fd+1, NULL, &wfd, NULL, &tv);
233-
234-
return ret != -1;
215+
int timeout = FG(default_socket_timeout) * 1000;
216+
return php_pollfd_for_ms(fd, POLLOUT, timeout) != -1;
235217
}
236218
#endif
237219

0 commit comments

Comments
 (0)