| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #if !defined(DART_IO_DISABLED) | 5 #if !defined(DART_IO_DISABLED) |
| 6 | 6 |
| 7 #include "platform/globals.h" | 7 #include "platform/globals.h" |
| 8 #if defined(TARGET_OS_LINUX) | 8 #if defined(TARGET_OS_LINUX) |
| 9 | 9 |
| 10 #include "bin/process.h" | 10 #include "bin/process.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 MonitorLocker locker(monitor_); | 156 MonitorLocker locker(monitor_); |
| 157 | 157 |
| 158 if (!running_) { | 158 if (!running_) { |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 | 161 |
| 162 // Set terminate_done_ to false, so we can use it as a guard for our | 162 // Set terminate_done_ to false, so we can use it as a guard for our |
| 163 // monitor. | 163 // monitor. |
| 164 running_ = false; | 164 running_ = false; |
| 165 | 165 |
| 166 // Fork to wake up waitpid. | 166 // Wake up the [ExitCodeHandler] thread which is blocked on `wait()` (see |
| 167 // [ExitCodeHandlerEntry]). |
| 167 if (TEMP_FAILURE_RETRY(fork()) == 0) { | 168 if (TEMP_FAILURE_RETRY(fork()) == 0) { |
| 168 exit(0); | 169 // We avoid running through registered atexit() handlers because that is |
| 170 // unnecessary work. |
| 171 _exit(0); |
| 169 } | 172 } |
| 170 | 173 |
| 171 monitor_->Notify(); | 174 monitor_->Notify(); |
| 172 | 175 |
| 173 while (!terminate_done_) { | 176 while (!terminate_done_) { |
| 174 monitor_->Wait(Monitor::kNoTimeout); | 177 monitor_->Wait(Monitor::kNoTimeout); |
| 175 } | 178 } |
| 176 } | 179 } |
| 177 | 180 |
| 178 private: | 181 private: |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 sigaction(signal, &act, NULL); | 990 sigaction(signal, &act, NULL); |
| 988 } | 991 } |
| 989 } | 992 } |
| 990 | 993 |
| 991 } // namespace bin | 994 } // namespace bin |
| 992 } // namespace dart | 995 } // namespace dart |
| 993 | 996 |
| 994 #endif // defined(TARGET_OS_LINUX) | 997 #endif // defined(TARGET_OS_LINUX) |
| 995 | 998 |
| 996 #endif // !defined(DART_IO_DISABLED) | 999 #endif // !defined(DART_IO_DISABLED) |
| OLD | NEW |