From f769448d531095b5c90cf94424e7eae12e953f71 Mon Sep 17 00:00:00 2001 From: "cpu@google.com" Date: Sat, 23 Aug 2008 02:03:18 +0000 Subject: 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 --- base/lock_impl_win.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'base') 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() { -- cgit v1.1