| OLD | NEW |
| 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 <process.h> | 5 #include <process.h> |
| 6 | 6 |
| 7 #include "bin/builtin.h" | 7 #include "bin/builtin.h" |
| 8 #include "bin/process.h" | 8 #include "bin/process.h" |
| 9 #include "bin/eventhandler.h" | 9 #include "bin/eventhandler.h" |
| 10 #include "bin/thread.h" | 10 #include "bin/thread.h" |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 504 |
| 505 bool Process::Kill(intptr_t id, int signal) { | 505 bool Process::Kill(intptr_t id, int signal) { |
| 506 USE(signal); // signal is not used on windows. | 506 USE(signal); // signal is not used on windows. |
| 507 HANDLE process_handle; | 507 HANDLE process_handle; |
| 508 HANDLE wait_handle; | 508 HANDLE wait_handle; |
| 509 HANDLE exit_pipe; | 509 HANDLE exit_pipe; |
| 510 bool success = ProcessInfoList::LookupProcess(id, | 510 bool success = ProcessInfoList::LookupProcess(id, |
| 511 &process_handle, | 511 &process_handle, |
| 512 &wait_handle, | 512 &wait_handle, |
| 513 &exit_pipe); | 513 &exit_pipe); |
| 514 if (!success) { | 514 // The process is already dead. |
| 515 return true; // The process has already died. Report a successful kill. | 515 if (!success) return false; |
| 516 } | |
| 517 BOOL result = TerminateProcess(process_handle, -1); | 516 BOOL result = TerminateProcess(process_handle, -1); |
| 518 return result ? true : false; | 517 return result ? true : false; |
| 519 } | 518 } |
| 520 | 519 |
| 521 | 520 |
| 522 void Process::TerminateExitCodeHandler() { | 521 void Process::TerminateExitCodeHandler() { |
| 523 // Nothing needs to be done on Windows. | 522 // Nothing needs to be done on Windows. |
| 524 } | 523 } |
| 525 | 524 |
| 526 | 525 |
| 527 intptr_t Process::CurrentProcessId() { | 526 intptr_t Process::CurrentProcessId() { |
| 528 return static_cast<intptr_t>(GetCurrentProcessId()); | 527 return static_cast<intptr_t>(GetCurrentProcessId()); |
| 529 } | 528 } |
| OLD | NEW |