Index: base/synchronization/lock_impl_win.cc |
diff --git a/base/synchronization/lock_impl_win.cc b/base/synchronization/lock_impl_win.cc |
index 86febe911a99d9e69f743a2f4498d1cf96f1b37f..fbc1bdd464b01254fb4bef8a9e2f1053553d3a07 100644 |
--- a/base/synchronization/lock_impl_win.cc |
+++ b/base/synchronization/lock_impl_win.cc |
@@ -8,7 +8,9 @@ |
namespace internal { |
LockImpl::LockImpl() { |
- ::InitializeCriticalSection(&native_handle_); |
+ // 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(&native_handle_, 2000); |
} |
LockImpl::~LockImpl() { |