diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-23 02:03:18 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-23 02:03:18 +0000 |
commit | f769448d531095b5c90cf94424e7eae12e953f71 (patch) | |
tree | 9b69ad402633f20f4fbe7b76cbe5a08691b2c68f /base/lock_impl_win.cc | |
parent | 5acb2cb8eed3ef2f6c244e13e2a0e39e607ab63f (diff) | |
download | chromium_src-f769448d531095b5c90cf94424e7eae12e953f71.zip chromium_src-f769448d531095b5c90cf94424e7eae12e953f71.tar.gz chromium_src-f769448d531095b5c90cf94424e7eae12e953f71.tar.bz2 |
Add a spinlock wait to the dearly beloved crititcal section
- the 2000 is a guess, I think the right number is between 1000 and 4000
- lets look at perf, if hurts then we remove it
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1271 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/lock_impl_win.cc')
-rw-r--r-- | base/lock_impl_win.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/base/lock_impl_win.cc b/base/lock_impl_win.cc index 5298176..a79f3a9 100644 --- a/base/lock_impl_win.cc +++ b/base/lock_impl_win.cc @@ -30,7 +30,9 @@ #include "base/lock_impl.h" LockImpl::LockImpl() { - ::InitializeCriticalSection(&os_lock_); + // The second parameter is the spin count, for short-held locks it avoid the + // contending thread from going to sleep which helps performance greatly. + ::InitializeCriticalSectionAndSpinCount(&os_lock_, 2000); } LockImpl::~LockImpl() { |