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

Side by Side Diff: runtime/bin/process_win.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_macos.cc ('k') | tests/standalone/io/signal_test_script.dart » ('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_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include <process.h> // NOLINT 8 #include <process.h> // NOLINT
9 9
10 #include "bin/builtin.h" 10 #include "bin/builtin.h"
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 write_handle->EnsureInitialized(EventHandler::delegate()); 913 write_handle->EnsureInitialized(EventHandler::delegate());
914 intptr_t write_fd = reinterpret_cast<intptr_t>(write_handle); 914 intptr_t write_fd = reinterpret_cast<intptr_t>(write_handle);
915 if (signal_handlers == NULL) { 915 if (signal_handlers == NULL) {
916 if (SetConsoleCtrlHandler(SignalHandler, true) == 0) { 916 if (SetConsoleCtrlHandler(SignalHandler, true) == 0) {
917 int error_code = GetLastError(); 917 int error_code = GetLastError();
918 delete write_handle; 918 delete write_handle;
919 CloseProcessPipe(fds); 919 CloseProcessPipe(fds);
920 SetLastError(error_code); 920 SetLastError(error_code);
921 return -1; 921 return -1;
922 } 922 }
923 signal_handlers = new SignalInfo(write_fd, signal);
924 } else {
925 new SignalInfo(write_fd, signal, signal_handlers);
926 } 923 }
924 signal_handlers = new SignalInfo(write_fd, signal, signal_handlers);
927 return reinterpret_cast<intptr_t>(new FileHandle(fds[kReadHandle])); 925 return reinterpret_cast<intptr_t>(new FileHandle(fds[kReadHandle]));
928 } 926 }
929 927
930 928
931 void Process::ClearSignalHandler(intptr_t signal) { 929 void Process::ClearSignalHandler(intptr_t signal) {
932 signal = GetWinSignal(signal); 930 signal = GetWinSignal(signal);
933 if (signal == -1) return; 931 if (signal == -1) return;
934 MutexLocker lock(signal_mutex); 932 MutexLocker lock(signal_mutex);
935 SignalInfo* handler = signal_handlers; 933 SignalInfo* handler = signal_handlers;
936 while (handler != NULL) { 934 while (handler != NULL) {
(...skipping 12 matching lines...) Expand all
949 USE(SetConsoleCtrlHandler(SignalHandler, false)); 947 USE(SetConsoleCtrlHandler(SignalHandler, false));
950 } 948 }
951 } 949 }
952 delete handler; 950 delete handler;
953 } 951 }
954 952
955 } // namespace bin 953 } // namespace bin
956 } // namespace dart 954 } // namespace dart
957 955
958 #endif // defined(TARGET_OS_WINDOWS) 956 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/bin/process_macos.cc ('k') | tests/standalone/io/signal_test_script.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698