Correct WorkDelegate::DoWork race condition with an atomic_bool.

Bug:crashpad:380
Change-Id: Iae523f22366ca65816c42b499bd482056efb5bca
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3244729
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
This commit is contained in:
Justin Cohen 2021-10-26 09:48:40 -04:00 committed by Crashpad LUCI CQ
parent 0118cc44aa
commit aaed581a53

View File

@ -15,6 +15,7 @@
#ifndef CRASHPAD_UTIL_THREAD_WORKER_THREAD_H_
#define CRASHPAD_UTIL_THREAD_WORKER_THREAD_H_
#include <atomic>
#include <memory>
#include "util/synchronization/semaphore.h"
@ -95,7 +96,7 @@ class WorkerThread {
Delegate* delegate_; // weak
std::unique_ptr<internal::WorkerThreadImpl> impl_;
bool running_;
bool do_work_now_;
std::atomic_bool do_work_now_;
};
} // namespace crashpad