| Index: runtime/vm/profiler_linux.cc
|
| diff --git a/runtime/vm/profiler_linux.cc b/runtime/vm/profiler_linux.cc
|
| index a58821d32a0c9c95d85e81898bcf29c451e0220d..b3aff0f111541f870d3cd4624394c3bef4dc05ce 100644
|
| --- a/runtime/vm/profiler_linux.cc
|
| +++ b/runtime/vm/profiler_linux.cc
|
| @@ -55,6 +55,10 @@ static void ProfileSignalAction(int signal, siginfo_t* info, void* context_) {
|
| if (profiler_data == NULL) {
|
| return;
|
| }
|
| + if (!profiler_data->CanExpire()) {
|
| + // Descheduled.
|
| + return;
|
| + }
|
|
|
| uintptr_t stack_lower = 0;
|
| uintptr_t stack_upper = 0;
|
| @@ -69,7 +73,7 @@ static void ProfileSignalAction(int signal, siginfo_t* info, void* context_) {
|
| // Thread owns no profiler locks at this point.
|
| // This call will acquire both ProfilerManager::monitor and the
|
| // isolate's profiler data mutex.
|
| - ProfilerManager::ScheduleIsolate(isolate);
|
| + ProfilerManager::ScheduleIsolate(isolate, true);
|
| }
|
|
|
|
|
| @@ -84,6 +88,12 @@ int64_t ProfilerManager::SampleAndRescheduleIsolates(int64_t current_time) {
|
| Isolate* isolate = isolates_[i];
|
| ScopedMutex isolate_lock(isolate->profiler_data_mutex());
|
| IsolateProfilerData* profiler_data = isolate->profiler_data();
|
| + if (profiler_data == NULL) {
|
| + // Isolate has been shutdown for profiling.
|
| + RemoveIsolate(i);
|
| + // Remove moves the last element into i, do not increment i.
|
| + continue;
|
| + }
|
| ASSERT(profiler_data != NULL);
|
| if (profiler_data->ShouldSample(current_time)) {
|
| pthread_kill(profiler_data->thread_id(), SIGPROF);
|
|
|