Skip to content

Commit a9ea252

Browse files
committed
Make poll always available
1 parent c57a8f7 commit a9ea252

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

main/poll/poll_backend_poll.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
#include "php_poll_internal.h"
1616

17-
#ifdef HAVE_POLL
18-
1917
#include <poll.h>
2018
#include <stdlib.h>
2119
#include <string.h>
@@ -217,8 +215,8 @@ static int poll_backend_wait(php_poll_ctx *ctx, php_poll_event *events, int max_
217215
poll_build_context build_ctx = { .fds = backend_data->temp_fds, .index = 0 };
218216
php_poll_fd_table_foreach(backend_data->fd_table, poll_build_fds_callback, &build_ctx);
219217

220-
/* Call poll() */
221-
int nfds = poll(backend_data->temp_fds, fd_count, timeout);
218+
/* Call poll() or its emulation (Windows) */
219+
int nfds = php_poll2(backend_data->temp_fds, fd_count, timeout);
222220

223221
if (nfds <= 0) {
224222
return nfds; /* Return 0 for timeout, -1 for error */
@@ -288,5 +286,3 @@ const php_poll_backend_ops php_poll_backend_poll_ops = {
288286
.get_suitable_max_events = poll_backend_get_suitable_max_events,
289287
.supports_et = false,
290288
};
291-
292-
#endif /* HAVE_POLL */

main/poll/poll_core.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ static int num_registered_backends = 0;
2020

2121
/* Forward declarations for backend ops */
2222

23-
#ifdef HAVE_POLL
2423
extern const php_poll_backend_ops php_poll_backend_poll_ops;
25-
#endif
2624
#ifdef HAVE_EPOLL
2725
extern const php_poll_backend_ops php_poll_backend_epoll_ops;
2826
#endif
@@ -68,10 +66,8 @@ PHPAPI void php_poll_register_backends(void)
6866
}
6967
#endif
7068

71-
#ifdef HAVE_POLL
72-
/* Poll is available on Unix-like systems */
69+
/* Poll or its emulation is always available */
7370
registered_backends[num_registered_backends++] = &php_poll_backend_poll_ops;
74-
#endif
7571

7672
/* select() as a fallback */
7773
if (php_poll_backend_select_ops.is_available()) {

0 commit comments

Comments
 (0)