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 BIN_SIGNAL_BLOCKER_H_ | 5 #ifndef BIN_SIGNAL_BLOCKER_H_ |
6 #define BIN_SIGNAL_BLOCKER_H_ | 6 #define BIN_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 |
16 namespace dart { | 18 namespace dart { |
17 namespace bin { | 19 namespace bin { |
18 | 20 |
19 class ThreadSignalBlocker { | 21 class ThreadSignalBlocker { |
20 public: | 22 public: |
21 explicit ThreadSignalBlocker(int sig) { | 23 explicit ThreadSignalBlocker(int sig) { |
22 sigset_t signal_mask; | 24 sigset_t signal_mask; |
23 sigemptyset(&signal_mask); | 25 sigemptyset(&signal_mask); |
24 sigaddset(&signal_mask, sig); | 26 sigaddset(&signal_mask, sig); |
25 // Add sig to signal mask. | 27 // Add sig to signal mask. |
(...skipping 20 matching lines...) Expand all Loading... |
46 } while (__result == -1L && errno == EINTR); \ | 48 } while (__result == -1L && errno == EINTR); \ |
47 __result; }) | 49 __result; }) |
48 | 50 |
49 #define VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(expression) \ | 51 #define VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(expression) \ |
50 (static_cast<void>(TEMP_FAILURE_RETRY_BLOCK_SIGNALS(expression))) | 52 (static_cast<void>(TEMP_FAILURE_RETRY_BLOCK_SIGNALS(expression))) |
51 | 53 |
52 } // namespace bin | 54 } // namespace bin |
53 } // namespace dart | 55 } // namespace dart |
54 | 56 |
55 #endif // BIN_SIGNAL_BLOCKER_H_ | 57 #endif // BIN_SIGNAL_BLOCKER_H_ |
OLD | NEW |