Fix MainLoop::RunImpl::get_sigmask() to correctly return empty sigset_t
when SIGNAL_POLLING_UNSUPPORTED is true. On NetBSD (and probably
on some other platforms), integers are not implicitly convertible to
sigset_t, so 'return 0' is erraneous. Instead, sigset_t should be reset
through sigemptyset().
While at it, move common parts out of the #ifdef.
Differential Revision: https://reviews.llvm.org/D57959
llvm-svn: 353675
}
sigset_t MainLoop::RunImpl::get_sigmask() {
-#if SIGNAL_POLLING_UNSUPPORTED
- return 0;
-#else
sigset_t sigmask;
+#if defined(_WIN32)
+ sigmask = 0;
+#elif SIGNAL_POLLING_UNSUPPORTED
+ sigemptyset(&sigmask);
+#else
int ret = pthread_sigmask(SIG_SETMASK, nullptr, &sigmask);
assert(ret == 0);
(void) ret;
for (const auto &sig : loop.m_signals)
sigdelset(&sigmask, sig.first);
- return sigmask;
#endif
+ return sigmask;
}
#ifdef __ANDROID__