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

Unified Diff: src/cpu-profiler.cc

Issue 632313002: Fix data race on CpuProfiler::running_ (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months 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 | « src/cpu-profiler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cpu-profiler.cc
diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc
index 68a565c73a2ffa4469948a1aa36b52e565f6947a..8bd3e4d8289832f8dc837c023e34d64f049ee47b 100644
--- a/src/cpu-profiler.cc
+++ b/src/cpu-profiler.cc
@@ -20,17 +20,16 @@ namespace internal {
static const int kProfilerStackSize = 64 * KB;
-ProfilerEventsProcessor::ProfilerEventsProcessor(
- ProfileGenerator* generator,
- Sampler* sampler,
- base::TimeDelta period)
+ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator,
+ Sampler* sampler,
+ base::TimeDelta period)
: Thread(Thread::Options("v8:ProfEvntProc", kProfilerStackSize)),
generator_(generator),
sampler_(sampler),
- running_(true),
+ running_(1),
period_(period),
- last_code_event_id_(0), last_processed_code_event_id_(0) {
-}
+ last_code_event_id_(0),
+ last_processed_code_event_id_(0) {}
void ProfilerEventsProcessor::Enqueue(const CodeEventsContainer& event) {
@@ -55,8 +54,7 @@ void ProfilerEventsProcessor::AddCurrentStack(Isolate* isolate) {
void ProfilerEventsProcessor::StopSynchronously() {
- if (!running_) return;
- running_ = false;
+ if (!base::NoBarrier_AtomicExchange(&running_, 0)) return;
Join();
}
@@ -107,7 +105,7 @@ ProfilerEventsProcessor::SampleProcessingResult
void ProfilerEventsProcessor::Run() {
- while (running_) {
+ while (!!base::NoBarrier_Load(&running_)) {
base::ElapsedTimer timer;
timer.Start();
// Keep processing existing events until we need to do next sample.
« no previous file with comments | « src/cpu-profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698