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

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

Issue 285023002: Fix listening for multiple signals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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') | runtime/bin/process_win.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_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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 for (int i = 0; i < kSignalsCount; i++) { 749 for (int i = 0; i < kSignalsCount; i++) {
750 sigaddset(&act.sa_mask, kSignals[i]); 750 sigaddset(&act.sa_mask, kSignals[i]);
751 } 751 }
752 intptr_t status = NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); 752 intptr_t status = NO_RETRY_EXPECTED(sigaction(signal, &act, NULL));
753 if (status < 0) { 753 if (status < 0) {
754 VOID_TEMP_FAILURE_RETRY(close(fds[0])); 754 VOID_TEMP_FAILURE_RETRY(close(fds[0]));
755 VOID_TEMP_FAILURE_RETRY(close(fds[1])); 755 VOID_TEMP_FAILURE_RETRY(close(fds[1]));
756 return -1; 756 return -1;
757 } 757 }
758 } 758 }
759 if (signal_handlers == NULL) { 759 signal_handlers = new SignalInfo(fds[1], signal, signal_handlers);
760 signal_handlers = new SignalInfo(fds[1], signal);
761 } else {
762 new SignalInfo(fds[1], signal, signal_handlers);
763 }
764 return fds[0]; 760 return fds[0];
765 } 761 }
766 762
767 763
768 void Process::ClearSignalHandler(intptr_t signal) { 764 void Process::ClearSignalHandler(intptr_t signal) {
769 signal = SignalMap(signal); 765 signal = SignalMap(signal);
770 if (signal == -1) return; 766 if (signal == -1) return;
771 ThreadSignalBlocker blocker(kSignalsCount, kSignals); 767 ThreadSignalBlocker blocker(kSignalsCount, kSignals);
772 MutexLocker lock(signal_mutex); 768 MutexLocker lock(signal_mutex);
773 SignalInfo* handler = signal_handlers; 769 SignalInfo* handler = signal_handlers;
(...skipping 18 matching lines...) Expand all
792 bzero(&act, sizeof(act)); 788 bzero(&act, sizeof(act));
793 act.sa_handler = SIG_DFL; 789 act.sa_handler = SIG_DFL;
794 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); 790 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL));
795 } 791 }
796 } 792 }
797 793
798 } // namespace bin 794 } // namespace bin
799 } // namespace dart 795 } // namespace dart
800 796
801 #endif // defined(TARGET_OS_MACOS) 797 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/process_linux.cc ('k') | runtime/bin/process_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698