Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1629)

Unified Diff: runtime/bin/signal_blocker.h

Issue 165723007: Move signal_blocker to platform and use it by default in TEMP_FAILURE_RETRY. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tiny fix. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/process_macos.cc ('k') | runtime/bin/socket_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/signal_blocker.h
diff --git a/runtime/bin/signal_blocker.h b/runtime/bin/signal_blocker.h
deleted file mode 100644
index 2b5fe1e9d8046190f2e82e4394478e5cff1628ed..0000000000000000000000000000000000000000
--- a/runtime/bin/signal_blocker.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-#ifndef BIN_SIGNAL_BLOCKER_H_
-#define BIN_SIGNAL_BLOCKER_H_
-
-#include "platform/globals.h"
-
-#if defined(TARGET_OS_WINDOWS)
-#error Do not include this file on Windows.
-#endif
-
-#include <signal.h> // NOLINT
-
-#include "platform/thread.h"
-
-namespace dart {
-namespace bin {
-
-class ThreadSignalBlocker {
- public:
- explicit ThreadSignalBlocker(int sig) {
- sigset_t signal_mask;
- sigemptyset(&signal_mask);
- 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);
- }
-
- private:
- sigset_t old;
-};
-
-
-#define TEMP_FAILURE_RETRY_BLOCK_SIGNALS(expression) \
- ({ ThreadSignalBlocker tsb(SIGPROF); \
- intptr_t __result; \
- do { \
- __result = (expression); \
- } while ((__result == -1L) && (errno == EINTR)); \
- __result; })
-
-#define VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(expression) \
- (static_cast<void>(TEMP_FAILURE_RETRY_BLOCK_SIGNALS(expression)))
-
-} // namespace bin
-} // namespace dart
-
-#endif // BIN_SIGNAL_BLOCKER_H_
« no previous file with comments | « runtime/bin/process_macos.cc ('k') | runtime/bin/socket_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698