summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/lock_impl_win.cc4
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() {