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

Side by Side Diff: runtime/bin/process_linux.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 | « runtime/bin/process_android.cc ('k') | runtime/bin/process_macos.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_LINUX) 6 #if defined(TARGET_OS_LINUX)
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 char** program_environment = NULL; 343 char** program_environment = NULL;
344 if (environment != NULL) { 344 if (environment != NULL) {
345 program_environment = new char*[environment_length + 1]; 345 program_environment = new char*[environment_length + 1];
346 for (int i = 0; i < environment_length; i++) { 346 for (int i = 0; i < environment_length; i++) {
347 program_environment[i] = environment[i]; 347 program_environment[i] = environment[i];
348 } 348 }
349 program_environment[environment_length] = NULL; 349 program_environment[environment_length] = NULL;
350 } 350 }
351 351
352 pid = TEMP_FAILURE_RETRY(fork()); 352 pid = TEMP_FAILURE_RETRY_BLOCK_SIGNALS(fork());
353 if (pid < 0) { 353 if (pid < 0) {
354 SetChildOsErrorMessage(os_error_message); 354 SetChildOsErrorMessage(os_error_message);
355 delete[] program_arguments; 355 delete[] program_arguments;
356 TEMP_FAILURE_RETRY(close(read_in[0])); 356 TEMP_FAILURE_RETRY(close(read_in[0]));
357 TEMP_FAILURE_RETRY(close(read_in[1])); 357 TEMP_FAILURE_RETRY(close(read_in[1]));
358 TEMP_FAILURE_RETRY(close(read_err[0])); 358 TEMP_FAILURE_RETRY(close(read_err[0]));
359 TEMP_FAILURE_RETRY(close(read_err[1])); 359 TEMP_FAILURE_RETRY(close(read_err[1]));
360 TEMP_FAILURE_RETRY(close(write_out[0])); 360 TEMP_FAILURE_RETRY(close(write_out[0]));
361 TEMP_FAILURE_RETRY(close(write_out[1])); 361 TEMP_FAILURE_RETRY(close(write_out[1]));
362 TEMP_FAILURE_RETRY(close(exec_control[0])); 362 TEMP_FAILURE_RETRY(close(exec_control[0]));
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 bzero(&act, sizeof(act)); 742 bzero(&act, sizeof(act));
743 act.sa_handler = SIG_DFL; 743 act.sa_handler = SIG_DFL;
744 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(sigaction(signal, &act, NULL)); 744 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(sigaction(signal, &act, NULL));
745 } 745 }
746 } 746 }
747 747
748 } // namespace bin 748 } // namespace bin
749 } // namespace dart 749 } // namespace dart
750 750
751 #endif // defined(TARGET_OS_LINUX) 751 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/bin/process_android.cc ('k') | runtime/bin/process_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698