Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PLATFORM_SIGNAL_BLOCKER_H_ | 5 #ifndef PLATFORM_SIGNAL_BLOCKER_H_ |
| 6 #define PLATFORM_SIGNAL_BLOCKER_H_ | 6 #define PLATFORM_SIGNAL_BLOCKER_H_ |
| 7 | 7 |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 #if defined(TARGET_OS_WINDOWS) | 10 #if defined(TARGET_OS_WINDOWS) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 // This macro can be used to insert checks that a call is made, that | 72 // This macro can be used to insert checks that a call is made, that |
| 73 // was expected to not return EINTR, but did it anyway. | 73 // was expected to not return EINTR, but did it anyway. |
| 74 #define NO_RETRY_EXPECTED(expression) \ | 74 #define NO_RETRY_EXPECTED(expression) \ |
| 75 ({ intptr_t __result = (expression); \ | 75 ({ intptr_t __result = (expression); \ |
| 76 ASSERT(__result != -1L || errno != EINTR); \ | 76 ASSERT(__result != -1L || errno != EINTR); \ |
| 77 __result; }) | 77 __result; }) |
| 78 | 78 |
| 79 #define VOID_NO_RETRY_EXPECTED(expression) \ | 79 #define VOID_NO_RETRY_EXPECTED(expression) \ |
| 80 (static_cast<void>(NO_RETRY_EXPECTED(expression))) | 80 (static_cast<void>(NO_RETRY_EXPECTED(expression))) |
| 81 | 81 |
| 82 // Versions of the above, that does not enter a signal blocking scope. Use only | |
| 83 // when a signal blocking scope is entered manually. | |
| 84 #define TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression) \ | |
|
Søren Gjesse
2014/03/25 08:21:23
It would be great if this macro could check that a
Anders Johnsen
2014/03/25 13:06:03
I've changed it to validate in debug mode, that it
| |
| 85 ({ intptr_t __result; \ | |
| 86 do { \ | |
| 87 __result = (expression); \ | |
| 88 } while ((__result == -1L) && (errno == EINTR)); \ | |
| 89 __result; }) | |
| 90 | |
| 91 #define VOID_TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression) \ | |
| 92 (static_cast<void>(TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression))) | |
| 93 | |
| 82 } // namespace dart | 94 } // namespace dart |
| 83 | 95 |
| 84 #endif // PLATFORM_SIGNAL_BLOCKER_H_ | 96 #endif // PLATFORM_SIGNAL_BLOCKER_H_ |
| OLD | NEW |