diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 22:25:44 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 22:25:44 +0000 |
commit | d2c7813156033f186d10370f0d1dfe06603fba92 (patch) | |
tree | a3a81cb9813592a03adcc0505d2b7cc11d9270a1 /chrome | |
parent | c7a405bae78bd8fd0cf3685abbd2939f9908e2cd (diff) | |
download | chromium_src-d2c7813156033f186d10370f0d1dfe06603fba92.zip chromium_src-d2c7813156033f186d10370f0d1dfe06603fba92.tar.gz chromium_src-d2c7813156033f186d10370f0d1dfe06603fba92.tar.bz2 |
Land http://codereview.chromium.org/1621010
My first chrome patch :) --
Data race on boole in chrome/browser/sync/engine/syncer.cc
Fix uses Lock class to avoid any compiler/hardware optimizations.
BUG=37408
TEST=Ran Valgrind/ThreadSanitizer
Original Patch by raz@chromium.org
http://codereview.chromium.org/1621010
Review URL: http://codereview.chromium.org/1518023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44558 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/sync/engine/syncer.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/sync/engine/syncer.h b/chrome/browser/sync/engine/syncer.h index e6be6d2..b387c7d 100644 --- a/chrome/browser/sync/engine/syncer.h +++ b/chrome/browser/sync/engine/syncer.h @@ -10,6 +10,7 @@ #include <vector> #include "base/basictypes.h" +#include "base/lock.h" #include "base/scoped_ptr.h" #include "chrome/browser/sync/engine/conflict_resolver.h" #include "chrome/browser/sync/engine/syncer_types.h" @@ -79,8 +80,14 @@ class Syncer { // Called by other threads to tell the syncer to stop what it's doing // and return early from SyncShare, if possible. - bool ExitRequested() { return early_exit_requested_; } - void RequestEarlyExit() { early_exit_requested_ = true; } + bool ExitRequested() { + AutoLock lock(early_exit_requested_lock_); + return early_exit_requested_; + } + void RequestEarlyExit() { + AutoLock lock(early_exit_requested_lock_); + early_exit_requested_ = true; + } // SyncShare(...) variants cause one sync cycle to occur. The return value // indicates whether we should sync again. If we should not sync again, @@ -139,6 +146,7 @@ class Syncer { SyncerStep last_step); bool early_exit_requested_; + Lock early_exit_requested_lock_; int32 max_commit_batch_size_; |