Index: runtime/bin/signal_blocker.h |
diff --git a/runtime/bin/signal_blocker.h b/runtime/bin/signal_blocker.h |
index e91edd9fe71b7c64cb2ae999c6437b66fcf3fe77..1ab816c145deda0af496c680557b4b146199b433 100644 |
--- a/runtime/bin/signal_blocker.h |
+++ b/runtime/bin/signal_blocker.h |
@@ -13,6 +13,8 @@ |
#include <signal.h> // NOLINT |
+#include "platform/thread.h" |
+ |
namespace dart { |
namespace bin { |
@@ -24,12 +26,26 @@ class ThreadSignalBlocker { |
sigaddset(&signal_mask, sig); |
// Add sig to signal mask. |
int r = pthread_sigmask(SIG_BLOCK, &signal_mask, &old); |
+ USE(r); |
+ ASSERT(r == 0); |
+ } |
+ |
+ ThreadSignalBlocker(int sigs_count, const int sigs[]) { |
+ sigset_t signal_mask; |
+ sigemptyset(&signal_mask); |
+ for (int i = 0; i < sigs_count; i++) { |
+ sigaddset(&signal_mask, sigs[i]); |
+ } |
+ // Add sig to signal mask. |
+ int r = pthread_sigmask(SIG_BLOCK, &signal_mask, &old); |
+ USE(r); |
ASSERT(r == 0); |
} |
~ThreadSignalBlocker() { |
// Restore signal mask. |
int r = pthread_sigmask(SIG_SETMASK, &old, NULL); |
+ USE(r); |
ASSERT(r == 0); |
} |