Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: runtime/bin/process_android.cc

Issue 176933006: Use signal-block around fork() to avoid we block it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/process_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include "bin/process.h" 8 #include "bin/process.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 if (!running_) { 145 if (!running_) {
146 return; 146 return;
147 } 147 }
148 148
149 // Set terminate_done_ to false, so we can use it as a guard for our 149 // Set terminate_done_ to false, so we can use it as a guard for our
150 // monitor. 150 // monitor.
151 running_ = false; 151 running_ = false;
152 152
153 // Fork to wake up waitpid. 153 // Fork to wake up waitpid.
154 if (TEMP_FAILURE_RETRY(fork()) == 0) { 154 if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS(fork()) == 0) {
155 exit(0); 155 exit(0);
156 } 156 }
157 157
158 monitor_->Notify(); 158 monitor_->Notify();
159 159
160 while (!terminate_done_) { 160 while (!terminate_done_) {
161 monitor_->Wait(dart::Monitor::kNoTimeout); 161 monitor_->Wait(dart::Monitor::kNoTimeout);
162 } 162 }
163 } 163 }
164 164
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 char** program_environment = NULL; 344 char** program_environment = NULL;
345 if (environment != NULL) { 345 if (environment != NULL) {
346 program_environment = new char*[environment_length + 1]; 346 program_environment = new char*[environment_length + 1];
347 for (int i = 0; i < environment_length; i++) { 347 for (int i = 0; i < environment_length; i++) {
348 program_environment[i] = environment[i]; 348 program_environment[i] = environment[i];
349 } 349 }
350 program_environment[environment_length] = NULL; 350 program_environment[environment_length] = NULL;
351 } 351 }
352 352
353 pid = TEMP_FAILURE_RETRY(fork()); 353 pid = TEMP_FAILURE_RETRY_BLOCK_SIGNALS(fork());
354 if (pid < 0) { 354 if (pid < 0) {
355 SetChildOsErrorMessage(os_error_message); 355 SetChildOsErrorMessage(os_error_message);
356 delete[] program_arguments; 356 delete[] program_arguments;
357 TEMP_FAILURE_RETRY(close(read_in[0])); 357 TEMP_FAILURE_RETRY(close(read_in[0]));
358 TEMP_FAILURE_RETRY(close(read_in[1])); 358 TEMP_FAILURE_RETRY(close(read_in[1]));
359 TEMP_FAILURE_RETRY(close(read_err[0])); 359 TEMP_FAILURE_RETRY(close(read_err[0]));
360 TEMP_FAILURE_RETRY(close(read_err[1])); 360 TEMP_FAILURE_RETRY(close(read_err[1]));
361 TEMP_FAILURE_RETRY(close(write_out[0])); 361 TEMP_FAILURE_RETRY(close(write_out[0]));
362 TEMP_FAILURE_RETRY(close(write_out[1])); 362 TEMP_FAILURE_RETRY(close(write_out[1]));
363 TEMP_FAILURE_RETRY(close(exec_control[0])); 363 TEMP_FAILURE_RETRY(close(exec_control[0]));
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 bzero(&act, sizeof(act)); 743 bzero(&act, sizeof(act));
744 act.sa_handler = SIG_DFL; 744 act.sa_handler = SIG_DFL;
745 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(sigaction(signal, &act, NULL)); 745 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(sigaction(signal, &act, NULL));
746 } 746 }
747 } 747 }
748 748
749 } // namespace bin 749 } // namespace bin
750 } // namespace dart 750 } // namespace dart
751 751
752 #endif // defined(TARGET_OS_ANDROID) 752 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/process_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698