Index: runtime/vm/profiler.cc |
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc |
index a6e53a7fb64832d7a1e2410b2c0a790f9402de8b..6ebe829103c80d7e52d29bf9af09abee0b4085bb 100644 |
--- a/runtime/vm/profiler.cc |
+++ b/runtime/vm/profiler.cc |
@@ -171,11 +171,6 @@ void ProfilerManager::ShutdownIsolateForProfiling(Isolate* isolate) { |
void ProfilerManager::ScheduleIsolateHelper(Isolate* isolate) { |
ScopedMonitor lock(monitor_); |
- intptr_t i = FindIsolate(isolate); |
- if (i >= 0) { |
- // Already scheduled. |
- return; |
- } |
{ |
ScopedMutex profiler_data_lock(isolate->profiler_data_mutex()); |
IsolateProfilerData* profiler_data = isolate->profiler_data(); |
@@ -185,6 +180,11 @@ void ProfilerManager::ScheduleIsolateHelper(Isolate* isolate) { |
profiler_data->Scheduled(OS::GetCurrentTimeMicros(), |
Thread::GetCurrentThreadId()); |
} |
+ intptr_t i = FindIsolate(isolate); |
+ if (i >= 0) { |
+ // Already scheduled. |
+ return; |
+ } |
AddIsolate(isolate); |
lock.Notify(); |
} |