Skip to content

Commit 79de998

Browse files
committed
Workaround for macos event loop bugs.
1 parent 1ff187e commit 79de998

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

source/loaders/node_loader/source/node_loader_impl.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4012,6 +4012,15 @@ void *node_loader_impl_register(void *node_impl_ptr, void *env_ptr, void *functi
40124012
node_impl->extra_active_handles.store(0);
40134013
node_impl->event_loop_empty.store(false);
40144014

4015+
/* In MacOS, from the beginning it seems there is active requests, for avoiding issues when closing
4016+
* let's remove them from the base active handles */
4017+
#if (defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__)
4018+
if ((int64_t)(node_impl->thread_loop->active_reqs.count > 0))
4019+
{
4020+
--node_impl->base_active_handles;
4021+
}
4022+
#endif
4023+
40154024
#if (!defined(NDEBUG) || defined(DEBUG) || defined(_DEBUG) || defined(__DEBUG) || defined(__DEBUG__))
40164025
node_loader_impl_print_handles(node_impl);
40174026
#endif

0 commit comments

Comments
 (0)