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

Unified Diff: base/threading/thread.cc

Issue 2182643002: Re-enable Thread::Stop() sequence checks and consequently remove |thread_lock|. Base URL: https://chromium.googlesource.com/chromium/src.git@a0_a_1_memorydumpmanagertests
Patch Set: Created 4 years, 5 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 | « base/threading/thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread.cc
diff --git a/base/threading/thread.cc b/base/threading/thread.cc
index 98610a63c09875878ffceca6417d7af16980ca89..7dae79b4c4d2fd81b4349a642fbfa0733a4bb363 100644
--- a/base/threading/thread.cc
+++ b/base/threading/thread.cc
@@ -95,17 +95,11 @@ bool Thread::StartWithOptions(const Options& options) {
message_loop_ = message_loop_owned.get();
start_event_.Reset();
- // Hold |thread_lock_| while starting the new thread to synchronize with
- // Stop() while it's not guaranteed to be sequenced (until crbug/629139 is
- // fixed).
- {
- AutoLock lock(thread_lock_);
- if (!PlatformThread::CreateWithPriority(options.stack_size, this, &thread_,
- options.priority)) {
- DLOG(ERROR) << "failed to create thread";
- message_loop_ = nullptr;
- return false;
- }
+ if (!PlatformThread::CreateWithPriority(options.stack_size, this, &thread_,
+ options.priority)) {
+ DLOG(ERROR) << "failed to create thread";
+ message_loop_ = nullptr;
+ return false;
}
// The ownership of |message_loop_| is managed by the newly created thread
@@ -135,11 +129,7 @@ bool Thread::WaitUntilThreadStarted() const {
}
void Thread::Stop() {
- // TODO(gab): Fix improper usage of this API (http://crbug.com/629139) and
- // enable this check, until then synchronization with Start() via
- // |thread_lock_| is required...
- // DCHECK(owning_sequence_checker_.CalledOnValidSequencedThread());
- AutoLock lock(thread_lock_);
+ DCHECK(owning_sequence_checker_.CalledOnValidSequencedThread());
if (thread_.is_null())
return;
@@ -162,9 +152,7 @@ void Thread::Stop() {
}
void Thread::StopSoon() {
- // TODO(gab): Fix improper usage of this API (http://crbug.com/629139) and
- // enable this check.
- // DCHECK(owning_sequence_checker_.CalledOnValidSequencedThread());
+ DCHECK(owning_sequence_checker_.CalledOnValidSequencedThread());
if (stopping_ || !message_loop_)
return;
« no previous file with comments | « base/threading/thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698