summaryrefslogtreecommitdiffstats
path: root/base/thread.cc
diff options
context:
space:
mode:
authortimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-21 17:03:46 +0000
committertimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-21 17:03:46 +0000
commit3c92e2472c00fb74f6bc01896235f1e98e6dfc19 (patch)
treea8830342b061047669a41c299b9cd7ba1397f01a /base/thread.cc
parentcf8bf30122f38a800ddf5ee7806a7cf8d019ed63 (diff)
downloadchromium_src-3c92e2472c00fb74f6bc01896235f1e98e6dfc19.zip
chromium_src-3c92e2472c00fb74f6bc01896235f1e98e6dfc19.tar.gz
chromium_src-3c92e2472c00fb74f6bc01896235f1e98e6dfc19.tar.bz2
Fix a harmless data race in Thread
Currently, if StopSoon/Stop is called twice (like in ThreadTest.StopSoon) message_loop_ can be accessed simultaneously by ThreadMain():162 and in StopSoon():124. This data race is harmless since stopping_==true, so message_loop_ value is actually un-needed. I'd like to swap the conditions to avoid reading message_loop_ in case stopping_==true. This way ThreadTest.StopSoon will have no race reports under ThreadSanitizer. Currently, this is the only report on base_unittests on ThreadSanitizer linux bot. Review URL: http://codereview.chromium.org/207039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26691 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/thread.cc')
-rw-r--r--base/thread.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/base/thread.cc b/base/thread.cc
index 5fc8678..09f20a7 100644
--- a/base/thread.cc
+++ b/base/thread.cc
@@ -121,7 +121,7 @@ void Thread::StopSoon() {
// We should only be called on the same thread that started us.
DCHECK_NE(thread_id_, PlatformThread::CurrentId());
- if (!message_loop_ || stopping_)
+ if (stopping_ || !message_loop_)
return;
stopping_ = true;