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) |
11 #error Do not include this file on Windows. | 11 #error Do not include this file on Windows. |
12 #endif | 12 #endif |
13 | 13 |
14 #include <signal.h> // NOLINT | 14 #include <signal.h> // NOLINT |
15 | 15 |
16 #include "platform/thread.h" | |
17 | |
18 namespace dart { | 16 namespace dart { |
19 | 17 |
20 class ThreadSignalBlocker { | 18 class ThreadSignalBlocker { |
21 public: | 19 public: |
22 explicit ThreadSignalBlocker(int sig) { | 20 explicit ThreadSignalBlocker(int sig) { |
23 sigset_t signal_mask; | 21 sigset_t signal_mask; |
24 sigemptyset(&signal_mask); | 22 sigemptyset(&signal_mask); |
25 sigaddset(&signal_mask, sig); | 23 sigaddset(&signal_mask, sig); |
26 // Add sig to signal mask. | 24 // Add sig to signal mask. |
27 int r = pthread_sigmask(SIG_BLOCK, &signal_mask, &old); | 25 int r = pthread_sigmask(SIG_BLOCK, &signal_mask, &old); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 __result = (expression); \ | 97 __result = (expression); \ |
100 } while ((__result == -1L) && (errno == EINTR)); \ | 98 } while ((__result == -1L) && (errno == EINTR)); \ |
101 __result; }) | 99 __result; }) |
102 | 100 |
103 #define VOID_TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression) \ | 101 #define VOID_TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression) \ |
104 (static_cast<void>(TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression))) | 102 (static_cast<void>(TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression))) |
105 | 103 |
106 } // namespace dart | 104 } // namespace dart |
107 | 105 |
108 #endif // PLATFORM_SIGNAL_BLOCKER_H_ | 106 #endif // PLATFORM_SIGNAL_BLOCKER_H_ |
OLD | NEW |