Index: runtime/vm/isolate.cc |
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
index 697aef86d87c8180253e0a3e2dff0e2ce41d9520..15091b58d9cc77c515c731d5ca412274ab46d407 100644 |
--- a/runtime/vm/isolate.cc |
+++ b/runtime/vm/isolate.cc |
@@ -989,6 +989,12 @@ Isolate* Isolate::Init(const char* name_prefix, |
} |
+Thread* Isolate::mutator_thread() const { |
+ ASSERT(thread_registry() != NULL); |
+ return thread_registry()->mutator_thread(); |
+} |
+ |
+ |
void Isolate::SetupInstructionsSnapshotPage( |
const uint8_t* instructions_snapshot_buffer) { |
InstructionsSnapshot snapshot(instructions_snapshot_buffer); |
@@ -2585,6 +2591,11 @@ Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) { |
// no_safepoint_scope_depth increments/decrements. |
MonitorLocker ml(threads_lock(), false); |
+ // Check to make sure we don't already have a mutator thread. |
+ if (is_mutator && mutator_thread_ != NULL) { |
+ return NULL; |
+ } |
+ |
// If a safepoint operation is in progress wait for it |
// to finish before scheduling this thread in. |
while (!bypass_safepoint && safepoint_handler()->SafepointInProgress()) { |