OSDN Git Service

ART: Host timeout Mac build fix.
authorAndreas Gampe <agampe@google.com>
Thu, 15 Jan 2015 02:35:01 +0000 (18:35 -0800)
committerAndreas Gampe <agampe@google.com>
Thu, 15 Jan 2015 02:35:01 +0000 (18:35 -0800)
Mac fix for unsupported SIGRTMIN introduced in commit
038bb2252ed1d7132f45006507e389b7ba1617ce.

Bug: 18933933
Change-Id: I502cda51802d67f089c09240d89f71166ed56c6d

runtime/runtime_linux.cc

index a0adcd1..55dfb0f 100644 (file)
@@ -34,6 +34,7 @@
 namespace art {
 
 static constexpr bool kDumpHeapObjectOnSigsevg = false;
+static constexpr bool kUseSigRTTimeout = true;
 
 struct Backtrace {
  public:
@@ -284,8 +285,14 @@ 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.
+  return -1;
+#else
+  return kUseSigRTTimeout ? (SIGRTMIN + 2) : -1;
+#endif
 }
 
 static bool IsTimeoutSignal(int signal_number) {
@@ -392,7 +399,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);
 }