Chromium Code Reviews| 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..664ad077e8aedcad5b7feae9fee83f1db948986f 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 not made, that |
|
Cutch
2014/03/14 14:40:39
"call is not made" -> "call is made"
Anders Johnsen
2014/03/17 13:35:33
Done.
|
| +// 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_ |