libuv: macos: use posix poll instead of kqueue

Since commit 5420639a8d (cmExecuteProcessCommand: Replace cmsysProcess
with cmUVProcessChain, 2023-06-01, v3.28.0-rc1~138^2~8) we've observed
spurious process hangs in `uv__io_poll` waiting for `kqueue` to deliver
events on macOS.

Issue: #25839
This commit is contained in:
Brad King
2024-03-31 10:43:05 -04:00
parent af330faaf1
commit f54ec4e7f9
3 changed files with 9 additions and 2 deletions

View File

@@ -191,8 +191,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
src/unix/bsd-ifaddrs.c
src/unix/darwin.c
src/unix/darwin-proctitle.c
src/unix/fsevents.c
src/unix/kqueue.c
src/unix/no-fsevents.c
src/unix/posix-poll.c
src/unix/proctitle.c
)
endif()

View File

@@ -30,6 +30,9 @@
# define UV_PLATFORM_SEM_T semaphore_t
#endif
#if 1 /* FIXME(#25839): use posix poll to avoid kqueue hangs on macOS. */
# include "posix.h"
#else
#define UV_HAVE_KQUEUE 1
#define UV_IO_PRIVATE_PLATFORM_FIELDS \
@@ -55,6 +58,8 @@
int cf_error; \
uv_mutex_t cf_mutex; \
#endif
#define UV_STREAM_PRIVATE_PLATFORM_FIELDS \
void* select; \

View File

@@ -41,6 +41,7 @@ static mach_timebase_info_data_t timebase;
typedef unsigned char UInt8;
#ifdef UV_HAVE_KQUEUE
int uv__platform_loop_init(uv_loop_t* loop) {
loop->cf_state = NULL;
@@ -54,6 +55,7 @@ int uv__platform_loop_init(uv_loop_t* loop) {
void uv__platform_loop_delete(uv_loop_t* loop) {
uv__fsevents_loop_delete(loop);
}
#endif
static void uv__hrtime_init_once(void) {