src: fix v8::CpuProfiler idle sampling · nodejs/node@b0df227
@@ -3567,10 +3567,6 @@ inline void PlatformInit() {
35673567RegisterSignalHandler(SIGINT, SignalExit, true);
35683568RegisterSignalHandler(SIGTERM, SignalExit, true);
356935693570-// Block SIGPROF signals when sleeping in epoll_wait/kevent/etc. Avoids the
3571-// performance penalty of frequent EINTR wakeups when the profiler is running.
3572-uv_loop_configure(uv_default_loop(), UV_LOOP_BLOCK_SIGNAL, SIGPROF);
3573-35743570// Raise the open file descriptor limit.
35753571struct rlimit lim;
35763572if (getrlimit(RLIMIT_NOFILE, &lim) == 0 && lim.rlim_cur != lim.rlim_max) {
@@ -3635,6 +3631,15 @@ void Init(int* argc,
36353631 }
36363632 }
363736333634+#ifdef __POSIX__
3635+// Block SIGPROF signals when sleeping in epoll_wait/kevent/etc. Avoids the
3636+// performance penalty of frequent EINTR wakeups when the profiler is running.
3637+// Only do this for v8.log profiling, as it breaks v8::CpuProfiler users.
3638+if (v8_is_profiling) {
3639+uv_loop_configure(uv_default_loop(), UV_LOOP_BLOCK_SIGNAL, SIGPROF);
3640+ }
3641+#endif
3642+36383643#if defined(NODE_HAVE_I18N_SUPPORT)
36393644if (icu_data_dir == nullptr) {
36403645// if the parameter isn't given, use the env variable.