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

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

Issue 2191723002: Fix race condition with HasMutatorThread that was being used without a lock. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address self review comments. Created 4 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 DARTSCOPE(Thread::Current()); 1337 DARTSCOPE(Thread::Current());
1338 Isolate* I = T->isolate(); 1338 Isolate* I = T->isolate();
1339 return Api::NewHandle(T, String::New(I->name())); 1339 return Api::NewHandle(T, String::New(I->name()));
1340 } 1340 }
1341 1341
1342 1342
1343 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { 1343 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) {
1344 CHECK_NO_ISOLATE(Isolate::Current()); 1344 CHECK_NO_ISOLATE(Isolate::Current());
1345 // TODO(16615): Validate isolate parameter. 1345 // TODO(16615): Validate isolate parameter.
1346 Isolate* iso = reinterpret_cast<Isolate*>(isolate); 1346 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
1347 if (iso->HasMutatorThread()) {
1348 FATAL("Multiple mutators within one isolate is not supported.");
1349 }
1350 if (!Thread::EnterIsolate(iso)) { 1347 if (!Thread::EnterIsolate(iso)) {
1351 FATAL("Unable to Enter Isolate as Dart VM is shutting down"); 1348 FATAL("Unable to Enter Isolate : "
1349 "Multiple mutators entering an isolate / "
1350 "Dart VM is shutting down");
1352 } 1351 }
1353 // A Thread structure has been associated to the thread, we do the 1352 // A Thread structure has been associated to the thread, we do the
1354 // safepoint transition explicity here instead of using the 1353 // safepoint transition explicity here instead of using the
1355 // TransitionXXX scope objects as the reverse transition happens 1354 // TransitionXXX scope objects as the reverse transition happens
1356 // outside this scope in Dart_ExitIsolate/Dart_ShutdownIsolate. 1355 // outside this scope in Dart_ExitIsolate/Dart_ShutdownIsolate.
1357 Thread* T = Thread::Current(); 1356 Thread* T = Thread::Current();
1358 T->set_execution_state(Thread::kThreadInNative); 1357 T->set_execution_state(Thread::kThreadInNative);
1359 T->EnterSafepoint(); 1358 T->EnterSafepoint();
1360 } 1359 }
1361 1360
(...skipping 5134 matching lines...) Expand 10 before | Expand all | Expand 10 after
6496 6495
6497 DART_EXPORT bool Dart_IsPrecompiledRuntime() { 6496 DART_EXPORT bool Dart_IsPrecompiledRuntime() {
6498 #if defined(DART_PRECOMPILED_RUNTIME) 6497 #if defined(DART_PRECOMPILED_RUNTIME)
6499 return true; 6498 return true;
6500 #else 6499 #else
6501 return false; 6500 return false;
6502 #endif 6501 #endif
6503 } 6502 }
6504 6503
6505 } // namespace dart 6504 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/isolate.h » ('j') | runtime/vm/isolate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698