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

Side by Side Diff: runtime/vm/service_isolate.cc

Issue 1275353005: VM thread shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 4 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 "vm/service_isolate.h" 5 #include "vm/service_isolate.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 ASSERT(monitor_ == NULL); 742 ASSERT(monitor_ == NULL);
743 monitor_ = new Monitor(); 743 monitor_ = new Monitor();
744 ASSERT(monitor_ != NULL); 744 ASSERT(monitor_ != NULL);
745 // Grab the isolate create callback here to avoid race conditions with tests 745 // Grab the isolate create callback here to avoid race conditions with tests
746 // that change this after Dart_Initialize returns. 746 // that change this after Dart_Initialize returns.
747 create_callback_ = Isolate::CreateCallback(); 747 create_callback_ = Isolate::CreateCallback();
748 Dart::thread_pool()->Run(new RunServiceTask()); 748 Dart::thread_pool()->Run(new RunServiceTask());
749 } 749 }
750 750
751 751
752 void ServiceIsolate::KillServiceIsolate() {
753 {
754 MonitorLocker ml(monitor_);
755 shutting_down_ = true;
756 }
757 isolate_->Kill();
Ivan Posva 2015/08/19 08:31:06 Need to make sure we own the isolate list lock whe
zra 2015/08/25 18:19:30 Added static KillIfExists to Isolate. It uses the
758 {
759 MonitorLocker ml(monitor_);
760 while (shutting_down_) {
761 ml.Wait();
762 }
763 }
764 }
765
766
752 void ServiceIsolate::Shutdown() { 767 void ServiceIsolate::Shutdown() {
753 if (!IsRunning()) { 768 if (!IsRunning()) {
769 if (isolate_ != NULL) {
770 // TODO(johnmccutchan,turnidge) When it is possible to properly create
771 // the VMService object and set up its shutdown handler in the service
772 // isolate's main() function, this case will no longer be possible and
773 // can be removed.
774 KillServiceIsolate();
775 }
754 return; 776 return;
755 } 777 }
756 { 778 {
757 MonitorLocker ml(monitor_); 779 MonitorLocker ml(monitor_);
758 shutting_down_ = true; 780 shutting_down_ = true;
759 } 781 }
760 SendServiceExitMessage(); 782 SendServiceExitMessage();
761 { 783 {
762 MonitorLocker ml(monitor_); 784 MonitorLocker ml(monitor_);
763 while (shutting_down_ && (port_ != ILLEGAL_PORT)) { 785 while (shutting_down_ && (port_ != ILLEGAL_PORT)) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 return result; 829 return result;
808 } 830 }
809 Dart_Handle source = GetSource(url_string); 831 Dart_Handle source = GetSource(url_string);
810 if (Dart_IsError(source)) { 832 if (Dart_IsError(source)) {
811 return source; 833 return source;
812 } 834 }
813 return Dart_LoadSource(library, url, source, 0, 0); 835 return Dart_LoadSource(library, url, source, 0, 0);
814 } 836 }
815 837
816 } // namespace dart 838 } // namespace dart
OLDNEW
« runtime/vm/isolate.cc ('K') | « runtime/vm/service_isolate.h ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698