diff options
Diffstat (limited to 'runtime/runtime_linux.cc')
-rw-r--r-- | runtime/runtime_linux.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/runtime/runtime_linux.cc b/runtime/runtime_linux.cc index a0adcd1082..35d944f1e6 100644 --- a/runtime/runtime_linux.cc +++ b/runtime/runtime_linux.cc @@ -25,6 +25,7 @@ #include "base/dumpable.h" #include "base/logging.h" +#include "base/macros.h" #include "base/mutex.h" #include "base/stringprintf.h" #include "thread-inl.h" @@ -34,6 +35,7 @@ namespace art { static constexpr bool kDumpHeapObjectOnSigsevg = false; +static constexpr bool kUseSigRTTimeout = true; struct Backtrace { public: @@ -284,8 +286,15 @@ struct UContext { mcontext_t& context; }; +// Return the signal number we recognize as timeout. -1 means not active/supported. static int GetTimeoutSignal() { - return SIGRTMIN + 2; +#if defined(__APPLE__) + // Mac does not support realtime signals. + UNUSED(kUseSigRTTimeout); + return -1; +#else + return kUseSigRTTimeout ? (SIGRTMIN + 2) : -1; +#endif } static bool IsTimeoutSignal(int signal_number) { @@ -392,7 +401,9 @@ void Runtime::InitPlatformSignalHandlers() { #endif rc += sigaction(SIGTRAP, &action, NULL); // Special dump-all timeout. - rc += sigaction(GetTimeoutSignal(), &action, NULL); + if (GetTimeoutSignal() != -1) { + rc += sigaction(GetTimeoutSignal(), &action, NULL); + } CHECK_EQ(rc, 0); } |