| 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 #include "bin/process.h" | 5 #include "bin/process.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <poll.h> | 9 #include <poll.h> |
| 10 #include <signal.h> | 10 #include <signal.h> |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 | 213 |
| 214 // Entry point for the separate exit code handler thread started by | 214 // Entry point for the separate exit code handler thread started by |
| 215 // the ExitCodeHandler. | 215 // the ExitCodeHandler. |
| 216 static void ExitCodeHandlerEntry(uword param) { | 216 static void ExitCodeHandlerEntry(uword param) { |
| 217 struct pollfd pollfds; | 217 struct pollfd pollfds; |
| 218 pollfds.fd = param; | 218 pollfds.fd = param; |
| 219 pollfds.events |= POLLIN; | 219 pollfds.events = POLLIN; |
| 220 while (true) { | 220 while (true) { |
| 221 int result = TEMP_FAILURE_RETRY(poll(&pollfds, 1, -1)); | 221 int result = TEMP_FAILURE_RETRY(poll(&pollfds, 1, -1)); |
| 222 if (result == -1) { | 222 if (result == -1) { |
| 223 ASSERT(EAGAIN == EWOULDBLOCK); | 223 ASSERT(EAGAIN == EWOULDBLOCK); |
| 224 if (errno != EWOULDBLOCK) { | 224 if (errno != EWOULDBLOCK) { |
| 225 perror("ExitCodeHandler poll failed"); | 225 perror("ExitCodeHandler poll failed"); |
| 226 } | 226 } |
| 227 } else { | 227 } else { |
| 228 // Read the byte from the wake-up fd. | 228 // Read the byte from the wake-up fd. |
| 229 ASSERT(result = 1); | 229 ASSERT(result = 1); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 if (result == -1) { | 556 if (result == -1) { |
| 557 return false; | 557 return false; |
| 558 } | 558 } |
| 559 return true; | 559 return true; |
| 560 } | 560 } |
| 561 | 561 |
| 562 | 562 |
| 563 void Process::TerminateExitCodeHandler() { | 563 void Process::TerminateExitCodeHandler() { |
| 564 ExitCodeHandler::TerminateExitCodeThread(); | 564 ExitCodeHandler::TerminateExitCodeThread(); |
| 565 } | 565 } |
| OLD | NEW |