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

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

Issue 92123002: Fix race discovered by Valgrind (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/profiler_macos.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/profiler.h" 9 #include "vm/profiler.h"
10 10
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 return lowest; 135 return lowest;
136 } 136 }
137 137
138 138
139 void ProfilerManager::ThreadMain(uword parameters) { 139 void ProfilerManager::ThreadMain(uword parameters) {
140 ASSERT(initialized_); 140 ASSERT(initialized_);
141 ASSERT(FLAG_profile); 141 ASSERT(FLAG_profile);
142 if (FLAG_trace_profiled_isolates) { 142 if (FLAG_trace_profiled_isolates) {
143 OS::Print("ProfilerManager Windows ready.\n"); 143 OS::Print("ProfilerManager Windows ready.\n");
144 } 144 }
145 thread_running_ = true;
146 { 145 {
147 // Signal to main thread we are ready. 146 // Signal to main thread we are ready.
148 ScopedMonitor startup_lock(start_stop_monitor_); 147 ScopedMonitor startup_lock(start_stop_monitor_);
148 thread_running_ = true;
149 startup_lock.Notify(); 149 startup_lock.Notify();
150 } 150 }
151 ScopedMonitor lock(monitor_); 151 ScopedMonitor lock(monitor_);
152 while (!shutdown_) { 152 while (!shutdown_) {
153 int64_t current_time = OS::GetCurrentTimeMicros(); 153 int64_t current_time = OS::GetCurrentTimeMicros();
154 int64_t next_sample = SampleAndRescheduleIsolates(current_time); 154 int64_t next_sample = SampleAndRescheduleIsolates(current_time);
155 lock.WaitMicros(next_sample); 155 lock.WaitMicros(next_sample);
156 } 156 }
157 if (FLAG_trace_profiled_isolates) { 157 if (FLAG_trace_profiled_isolates) {
158 OS::Print("ProfilerManager Windows exiting.\n"); 158 OS::Print("ProfilerManager Windows exiting.\n");
159 } 159 }
160 thread_running_ = false;
161 { 160 {
162 // Signal to main thread we are exiting. 161 // Signal to main thread we are exiting.
163 ScopedMonitor shutdown_lock(start_stop_monitor_); 162 ScopedMonitor shutdown_lock(start_stop_monitor_);
163 thread_running_ = false;
164 shutdown_lock.Notify(); 164 shutdown_lock.Notify();
165 } 165 }
166 } 166 }
167 167
168 } // namespace dart 168 } // namespace dart
169 169
170 #endif // defined(TARGET_OS_WINDOWS) 170 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/vm/profiler_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698