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

Side by Side Diff: runtime/bin/process_macos.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_linux.cc ('k') | no next file » | 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_MACOS) 6 #if defined(TARGET_OS_MACOS)
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 if (!running_) { 144 if (!running_) {
145 return; 145 return;
146 } 146 }
147 147
148 // Set terminate_done_ to false, so we can use it as a guard for our 148 // Set terminate_done_ to false, so we can use it as a guard for our
149 // monitor. 149 // monitor.
150 running_ = false; 150 running_ = false;
151 151
152 // Fork to wake up waitpid. 152 // Fork to wake up waitpid.
153 if (TEMP_FAILURE_RETRY(fork()) == 0) { 153 if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS(fork()) == 0) {
154 exit(0); 154 exit(0);
155 } 155 }
156 156
157 monitor_->Notify(); 157 monitor_->Notify();
158 158
159 while (!terminate_done_) { 159 while (!terminate_done_) {
160 monitor_->Wait(dart::Monitor::kNoTimeout); 160 monitor_->Wait(dart::Monitor::kNoTimeout);
161 } 161 }
162 } 162 }
163 163
(...skipping 178 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 VOID_TEMP_FAILURE_RETRY(close(read_in[0])); 356 VOID_TEMP_FAILURE_RETRY(close(read_in[0]));
357 VOID_TEMP_FAILURE_RETRY(close(read_in[1])); 357 VOID_TEMP_FAILURE_RETRY(close(read_in[1]));
358 VOID_TEMP_FAILURE_RETRY(close(read_err[0])); 358 VOID_TEMP_FAILURE_RETRY(close(read_err[0]));
359 VOID_TEMP_FAILURE_RETRY(close(read_err[1])); 359 VOID_TEMP_FAILURE_RETRY(close(read_err[1]));
360 VOID_TEMP_FAILURE_RETRY(close(write_out[0])); 360 VOID_TEMP_FAILURE_RETRY(close(write_out[0]));
361 VOID_TEMP_FAILURE_RETRY(close(write_out[1])); 361 VOID_TEMP_FAILURE_RETRY(close(write_out[1]));
362 VOID_TEMP_FAILURE_RETRY(close(exec_control[0])); 362 VOID_TEMP_FAILURE_RETRY(close(exec_control[0]));
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 bzero(&act, sizeof(act)); 788 bzero(&act, sizeof(act));
789 act.sa_handler = SIG_DFL; 789 act.sa_handler = SIG_DFL;
790 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(sigaction(signal, &act, NULL)); 790 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(sigaction(signal, &act, NULL));
791 } 791 }
792 } 792 }
793 793
794 } // namespace bin 794 } // namespace bin
795 } // namespace dart 795 } // namespace dart
796 796
797 #endif // defined(TARGET_OS_MACOS) 797 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/process_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698