Revision: 24439
Author: [email protected]
Date: Tue Oct 7 14:45:17 2014 UTC
Log: Fix data race on CpuProfiler::running_
BUG=v8:3613
[email protected]
LOG=n
Review URL: https://codereview.chromium.org/632313002
https://code.google.com/p/v8/source/detail?r=24439
Modified:
/branches/bleeding_edge/src/cpu-profiler.cc
/branches/bleeding_edge/src/cpu-profiler.h
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.cc Thu Oct 2 11:58:21 2014 UTC
+++ /branches/bleeding_edge/src/cpu-profiler.cc Tue Oct 7 14:45:17 2014 UTC
@@ -20,17 +20,16 @@
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::StopSynchronously() {
- if (!running_) return;
- running_ = false;
+ if (!base::NoBarrier_AtomicExchange(&running_, 0)) return;
Join();
}
@@ -107,7 +105,7 @@
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.
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.h Tue Aug 5 07:31:17 2014 UTC
+++ /branches/bleeding_edge/src/cpu-profiler.h Tue Oct 7 14:45:17 2014 UTC
@@ -132,7 +132,7 @@
// Thread control.
virtual void Run();
void StopSynchronously();
- INLINE(bool running()) { return running_; }
+ INLINE(bool running()) { return !!base::NoBarrier_Load(&running_); }
void Enqueue(const CodeEventsContainer& event);
// Puts current stack into tick sample events buffer.
@@ -163,7 +163,7 @@
ProfileGenerator* generator_;
Sampler* sampler_;
- bool running_;
+ base::Atomic32 running_;
// Sampling period in microseconds.
const base::TimeDelta period_;
UnboundQueue<CodeEventsContainer> events_buffer_;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.