Commit 81ceccd5 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[test] Fix timeout in AddTraceEventMultiThreaded

Initializing running_ to true in Run() could happen after Stop().

Bug: v8:10315
Change-Id: Ibde2ff8cb8a5db862f970df261481cb55f8b6c96
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2436459Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70191}
parent 21d95415
......@@ -477,8 +477,7 @@ class TraceWritingThread : public base::Thread {
tracing_controller_(tracing_controller) {}
void Run() override {
running_.store(true);
while (running_.load()) {
while (!stopped_.load()) {
TRACE_EVENT0("v8", "v8.Test");
tracing_controller_->AddTraceEvent('A', nullptr, "v8", "", 1, 1, 0,
nullptr, nullptr, nullptr, nullptr, 0);
......@@ -488,10 +487,10 @@ class TraceWritingThread : public base::Thread {
}
}
void Stop() { running_.store(false); }
void Stop() { stopped_.store(true); }
private:
std::atomic_bool running_{false};
std::atomic_bool stopped_{false};
v8::platform::tracing::TracingController* tracing_controller_;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment