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

Unified Diff: runtime/vm/service_isolate.cc

Issue 1275353005: VM thread shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/service_isolate.h ('k') | runtime/vm/thread_interrupter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service_isolate.cc
diff --git a/runtime/vm/service_isolate.cc b/runtime/vm/service_isolate.cc
index 2068e4027192c70536171c32266089a9b34bcd5d..29a71ceb249ce7e4c8d81c52edfad7f05c53343e 100644
--- a/runtime/vm/service_isolate.cc
+++ b/runtime/vm/service_isolate.cc
@@ -675,6 +675,8 @@ class RunServiceTask : public ThreadPool::Task {
static void ShutdownIsolate(uword parameter) {
Isolate* I = reinterpret_cast<Isolate*>(parameter);
ASSERT(ServiceIsolate::IsServiceIsolate(I));
+ ServiceIsolate::SetServiceIsolate(NULL);
+ ServiceIsolate::SetServicePort(ILLEGAL_PORT);
{
// Print the error if there is one. This may execute dart code to
// print the exception object, so we need to use a StartIsolateScope.
@@ -695,8 +697,6 @@ class RunServiceTask : public ThreadPool::Task {
SwitchIsolateScope switch_scope(I);
Dart::ShutdownIsolate();
}
- ServiceIsolate::SetServiceIsolate(NULL);
- ServiceIsolate::SetServicePort(ILLEGAL_PORT);
if (FLAG_trace_service) {
OS::Print("vm-service: Shutdown.\n");
}
@@ -762,8 +762,30 @@ void ServiceIsolate::Run() {
}
+void ServiceIsolate::KillServiceIsolate() {
+ {
+ MonitorLocker ml(monitor_);
+ shutting_down_ = true;
+ }
+ Isolate::KillIfExists(isolate_);
+ {
+ MonitorLocker ml(monitor_);
+ while (shutting_down_) {
+ ml.Wait();
+ }
+ }
+}
+
+
void ServiceIsolate::Shutdown() {
if (!IsRunning()) {
+ if (isolate_ != NULL) {
+ // TODO(johnmccutchan,turnidge) When it is possible to properly create
+ // the VMService object and set up its shutdown handler in the service
+ // isolate's main() function, this case will no longer be possible and
+ // can be removed.
+ KillServiceIsolate();
+ }
return;
}
{
« no previous file with comments | « runtime/vm/service_isolate.h ('k') | runtime/vm/thread_interrupter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698