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

Unified Diff: runtime/vm/profiler.cc

Issue 88403002: Guard against profiler shutdown race (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index 9dcb8c72883df99d8f79a1e23e73a7c3b2048ed9..3cfc3d3e0c0ccf0dc57de73f0c2105b718caed72 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -68,7 +68,7 @@ namespace dart {
// fail (sometimes leading to a crash).
//
-DEFINE_FLAG(bool, profile, false, "Enable Sampling Profiler");
+DEFINE_FLAG(bool, profile, true, "Enable Sampling Profiler");
DEFINE_FLAG(bool, trace_profiled_isolates, false, "Trace profiled isolates.");
bool ProfilerManager::initialized_ = false;
@@ -141,7 +141,6 @@ void ProfilerManager::Shutdown() {
shutdown_lock.Wait();
}
}
- initialized_ = false;
if (FLAG_trace_profiled_isolates) {
OS::Print("ProfilerManager shut down (%" Pd ").\n", size_at_shutdown);
}
@@ -212,6 +211,10 @@ void ProfilerManager::ShutdownIsolateForProfiling(Isolate* isolate) {
void ProfilerManager::ScheduleIsolateHelper(Isolate* isolate) {
ScopedMonitor lock(monitor_);
{
+ if (shutdown_) {
+ // Shutdown.
+ return;
+ }
ScopedMutex profiler_data_lock(isolate->profiler_data_mutex());
IsolateProfilerData* profiler_data = isolate->profiler_data();
if (profiler_data == NULL) {
@@ -260,6 +263,10 @@ void ProfilerManager::DescheduleIsolate(Isolate* isolate) {
ScopedSignalBlocker ssb;
{
ScopedMonitor lock(monitor_);
+ if (shutdown_) {
+ // Shutdown.
+ return;
+ }
intptr_t i = FindIsolate(isolate);
if (i < 0) {
// Not scheduled.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698