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

Unified Diff: runtime/platform/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/platform/platform_sources.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/signal_blocker.h
diff --git a/runtime/bin/signal_blocker.h b/runtime/platform/signal_blocker.h
similarity index 60%
rename from runtime/bin/signal_blocker.h
rename to runtime/platform/signal_blocker.h
index 2b5fe1e9d8046190f2e82e4394478e5cff1628ed..4bfc2287a6ed4150fc77ef51cfaee82326e05cfa 100644
--- a/runtime/bin/signal_blocker.h
+++ b/runtime/platform/signal_blocker.h
@@ -2,8 +2,8 @@
// 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_
+#ifndef PLATFORM_SIGNAL_BLOCKER_H_
+#define PLATFORM_SIGNAL_BLOCKER_H_
#include "platform/globals.h"
@@ -16,7 +16,6 @@
#include "platform/thread.h"
namespace dart {
-namespace bin {
class ThreadSignalBlocker {
public:
@@ -54,7 +53,10 @@ class ThreadSignalBlocker {
};
-#define TEMP_FAILURE_RETRY_BLOCK_SIGNALS(expression) \
+// The definition below is copied from Linux and adapted to avoid lint
+// errors (type long int changed to intptr_t and do/while split on
+// separate lines with body in {}s) and to also block signals.
+#define TEMP_FAILURE_RETRY(expression) \
({ ThreadSignalBlocker tsb(SIGPROF); \
intptr_t __result; \
do { \
@@ -62,10 +64,21 @@ class ThreadSignalBlocker {
} while ((__result == -1L) && (errno == EINTR)); \
__result; })
-#define VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(expression) \
- (static_cast<void>(TEMP_FAILURE_RETRY_BLOCK_SIGNALS(expression)))
+// This is a version of TEMP_FAILURE_RETRY which does not use the value
+// returned from the expression.
+#define VOID_TEMP_FAILURE_RETRY(expression) \
+ (static_cast<void>(TEMP_FAILURE_RETRY(expression)))
+
+// This macro can be used to insert checks that a call is made, that
+// was expected to not return EINTR, but did it anyway.
+#define NO_RETRY_EXPECTED(expression) \
+ ({ intptr_t __result = (expression); \
+ ASSERT(__result != -1L || errno != EINTR); \
+ __result; })
+
+#define VOID_NO_RETRY_EXPECTED(expression) \
+ (static_cast<void>(NO_RETRY_EXPECTED(expression)))
-} // namespace bin
} // namespace dart
-#endif // BIN_SIGNAL_BLOCKER_H_
+#endif // PLATFORM_SIGNAL_BLOCKER_H_
« no previous file with comments | « runtime/platform/platform_sources.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698