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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 // This is a version of TEMP_FAILURE_RETRY which does not use the value | 67 // This is a version of TEMP_FAILURE_RETRY which does not use the value |
68 // returned from the expression. | 68 // returned from the expression. |
69 #define VOID_TEMP_FAILURE_RETRY(expression) \ | 69 #define VOID_TEMP_FAILURE_RETRY(expression) \ |
70 (static_cast<void>(TEMP_FAILURE_RETRY(expression))) | 70 (static_cast<void>(TEMP_FAILURE_RETRY(expression))) |
71 | 71 |
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 if (__result == -1L && errno == EINTR) { \ |
| 77 FATAL("Unexpected EINTR errno"); \ |
| 78 } \ |
77 __result; }) | 79 __result; }) |
78 | 80 |
79 #define VOID_NO_RETRY_EXPECTED(expression) \ | 81 #define VOID_NO_RETRY_EXPECTED(expression) \ |
80 (static_cast<void>(NO_RETRY_EXPECTED(expression))) | 82 (static_cast<void>(NO_RETRY_EXPECTED(expression))) |
81 | 83 |
82 // Define to check in debug mode, if a signal is currently being blocked. | 84 // Define to check in debug mode, if a signal is currently being blocked. |
83 #define CHECK_IS_BLOCKING(signal) \ | 85 #define CHECK_IS_BLOCKING(signal) \ |
84 ({ sigset_t signal_mask; \ | 86 ({ sigset_t signal_mask; \ |
85 int __r = pthread_sigmask(SIG_BLOCK, NULL, &signal_mask); \ | 87 int __r = pthread_sigmask(SIG_BLOCK, NULL, &signal_mask); \ |
86 USE(__r); \ | 88 USE(__r); \ |
(...skipping 10 matching lines...) Expand all Loading... |
97 __result = (expression); \ | 99 __result = (expression); \ |
98 } while ((__result == -1L) && (errno == EINTR)); \ | 100 } while ((__result == -1L) && (errno == EINTR)); \ |
99 __result; }) | 101 __result; }) |
100 | 102 |
101 #define VOID_TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression) \ | 103 #define VOID_TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression) \ |
102 (static_cast<void>(TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression))) | 104 (static_cast<void>(TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression))) |
103 | 105 |
104 } // namespace dart | 106 } // namespace dart |
105 | 107 |
106 #endif // PLATFORM_SIGNAL_BLOCKER_H_ | 108 #endif // PLATFORM_SIGNAL_BLOCKER_H_ |
OLD | NEW |