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

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

Issue 1560853002: Fix Shutdown race. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | no next file » | 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) 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 ShutdownIsolate, 337 ShutdownIsolate,
338 reinterpret_cast<uword>(isolate)); 338 reinterpret_cast<uword>(isolate));
339 } 339 }
340 340
341 protected: 341 protected:
342 static void ShutdownIsolate(uword parameter) { 342 static void ShutdownIsolate(uword parameter) {
343 Isolate* I = reinterpret_cast<Isolate*>(parameter); 343 Isolate* I = reinterpret_cast<Isolate*>(parameter);
344 ASSERT(ServiceIsolate::IsServiceIsolate(I)); 344 ASSERT(ServiceIsolate::IsServiceIsolate(I));
345 ServiceIsolate::SetServiceIsolate(NULL); 345 ServiceIsolate::SetServiceIsolate(NULL);
346 ServiceIsolate::SetServicePort(ILLEGAL_PORT); 346 ServiceIsolate::SetServicePort(ILLEGAL_PORT);
347 I->WaitForOutstandingSpawns();
347 { 348 {
348 // Print the error if there is one. This may execute dart code to 349 // Print the error if there is one. This may execute dart code to
349 // print the exception object, so we need to use a StartIsolateScope. 350 // print the exception object, so we need to use a StartIsolateScope.
350 ASSERT(Isolate::Current() == NULL); 351 ASSERT(Isolate::Current() == NULL);
351 StartIsolateScope start_scope(I); 352 StartIsolateScope start_scope(I);
352 Thread* T = Thread::Current(); 353 Thread* T = Thread::Current();
353 ASSERT(I == T->isolate()); 354 ASSERT(I == T->isolate());
354 StackZone zone(T); 355 StackZone zone(T);
355 HandleScope handle_scope(T); 356 HandleScope handle_scope(T);
356 Error& error = Error::Handle(Z); 357 Error& error = Error::Handle(Z);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 ASSERT(!result.IsNull()); 485 ASSERT(!result.IsNull());
485 Dart_Port port = ILLEGAL_PORT; 486 Dart_Port port = ILLEGAL_PORT;
486 if (result.IsReceivePort()) { 487 if (result.IsReceivePort()) {
487 port = ReceivePort::Cast(result).Id(); 488 port = ReceivePort::Cast(result).Id();
488 } 489 }
489 ASSERT(port != ILLEGAL_PORT); 490 ASSERT(port != ILLEGAL_PORT);
490 ServiceIsolate::SetServicePort(port); 491 ServiceIsolate::SetServicePort(port);
491 } 492 }
492 493
493 } // namespace dart 494 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698