thread: use InitializeCriticalSectionEx if available

Windows Vista / Server 2008 and up

Change-Id: I32c5b4e5384d614c5a821ef511293ff014c67966
This commit is contained in:
James Zern 2015-11-23 20:38:46 -08:00
parent 110ad5835e
commit 63fadc9ffa

View File

@ -81,7 +81,11 @@ static int pthread_join(pthread_t thread, void** value_ptr) {
// Mutex
static int pthread_mutex_init(pthread_mutex_t* const mutex, void* mutexattr) {
(void)mutexattr;
#if _WIN32_WINNT >= 0x0600 // Windows Vista / Server 2008 or greater
InitializeCriticalSectionEx(mutex, 0 /*dwSpinCount*/, 0 /*Flags*/);
#else
InitializeCriticalSection(mutex);
#endif
return 0;
}