Windows: use spin counts for osi base locks

On multiprocessor systems, spin counts are faster than entering
a processor wait state when there is critical section contention.
Microsoft recommends a count of 4000.  This feature is only available
on XP and above which is fine since OpenAFS master and 1.7 no longer
support Windows 2000.

Change-Id: I1b40d00b2a91e60e1676a53e1c38eb5f9bfadc69
Reviewed-on: http://gerrit.openafs.org/7719
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
This commit is contained in:
Jeffrey Altman 2012-07-05 16:52:51 -04:00
parent f4baf7cf99
commit d5f067aa73

View File

@ -35,7 +35,7 @@ void osi_BaseInit(void)
int i;
for(i=0; i<OSI_MUTEXHASHSIZE; i++)
InitializeCriticalSection(&osi_baseAtomicCS[i]);
InitializeCriticalSectionAndSpinCount(&osi_baseAtomicCS[i], 4000);
if ((tls_LockRefH = TlsAlloc()) == TLS_OUT_OF_INDEXES)
osi_panic("TlsAlloc(tls_LockRefH) failure", __FILE__, __LINE__);
@ -43,7 +43,7 @@ void osi_BaseInit(void)
if ((tls_LockRefT = TlsAlloc()) == TLS_OUT_OF_INDEXES)
osi_panic("TlsAlloc(tls_LockRefT) failure", __FILE__, __LINE__);
InitializeCriticalSection(&lock_ref_CS);
InitializeCriticalSectionAndSpinCount(&lock_ref_CS, 4000);
}
void