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

Side by Side Diff: runtime/bin/process_android.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.h ('k') | 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 for (int i = 0; i < kSignalsCount; i++) { 703 for (int i = 0; i < kSignalsCount; i++) {
704 sigaddset(&act.sa_mask, kSignals[i]); 704 sigaddset(&act.sa_mask, kSignals[i]);
705 } 705 }
706 int status = NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); 706 int status = NO_RETRY_EXPECTED(sigaction(signal, &act, NULL));
707 if (status < 0) { 707 if (status < 0) {
708 VOID_TEMP_FAILURE_RETRY(close(fds[0])); 708 VOID_TEMP_FAILURE_RETRY(close(fds[0]));
709 VOID_TEMP_FAILURE_RETRY(close(fds[1])); 709 VOID_TEMP_FAILURE_RETRY(close(fds[1]));
710 return -1; 710 return -1;
711 } 711 }
712 } 712 }
713 if (signal_handlers == NULL) { 713 signal_handlers = new SignalInfo(fds[1], signal, signal_handlers);
714 signal_handlers = new SignalInfo(fds[1], signal);
715 } else {
716 new SignalInfo(fds[1], signal, signal_handlers);
717 }
718 return fds[0]; 714 return fds[0];
719 } 715 }
720 716
721 717
722 void Process::ClearSignalHandler(intptr_t signal) { 718 void Process::ClearSignalHandler(intptr_t signal) {
723 ThreadSignalBlocker blocker(kSignalsCount, kSignals); 719 ThreadSignalBlocker blocker(kSignalsCount, kSignals);
724 MutexLocker lock(signal_mutex); 720 MutexLocker lock(signal_mutex);
725 SignalInfo* handler = signal_handlers; 721 SignalInfo* handler = signal_handlers;
726 bool unlisten = true; 722 bool unlisten = true;
727 while (handler != NULL) { 723 while (handler != NULL) {
(...skipping 16 matching lines...) Expand all
744 bzero(&act, sizeof(act)); 740 bzero(&act, sizeof(act));
745 act.sa_handler = SIG_DFL; 741 act.sa_handler = SIG_DFL;
746 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); 742 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL));
747 } 743 }
748 } 744 }
749 745
750 } // namespace bin 746 } // namespace bin
751 } // namespace dart 747 } // namespace dart
752 748
753 #endif // defined(TARGET_OS_ANDROID) 749 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « runtime/bin/process.h ('k') | runtime/bin/process_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698