]> git.proxmox.com Git - rustc.git/blobdiff - src/jemalloc/include/jemalloc/internal/mutex.h
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / jemalloc / include / jemalloc / internal / mutex.h
index 8a03d82504ecc5e3af73d0517dfb5ae2b7ea2d48..f051f2917b3b7611024a3b2cfb487b2875f28466 100644 (file)
@@ -26,7 +26,11 @@ typedef struct malloc_mutex_s malloc_mutex_t;
 
 struct malloc_mutex_s {
 #ifdef _WIN32
+#  if _WIN32_WINNT >= 0x0600
+       SRWLOCK                 lock;
+#  else
        CRITICAL_SECTION        lock;
+#  endif
 #elif (defined(JEMALLOC_OSSPIN))
        OSSpinLock              lock;
 #elif (defined(JEMALLOC_MUTEX_INIT_CB))
@@ -70,7 +74,11 @@ malloc_mutex_lock(malloc_mutex_t *mutex)
 
        if (isthreaded) {
 #ifdef _WIN32
+#  if _WIN32_WINNT >= 0x0600
+               AcquireSRWLockExclusive(&mutex->lock);
+#  else
                EnterCriticalSection(&mutex->lock);
+#  endif
 #elif (defined(JEMALLOC_OSSPIN))
                OSSpinLockLock(&mutex->lock);
 #else
@@ -85,7 +93,11 @@ malloc_mutex_unlock(malloc_mutex_t *mutex)
 
        if (isthreaded) {
 #ifdef _WIN32
+#  if _WIN32_WINNT >= 0x0600
+               ReleaseSRWLockExclusive(&mutex->lock);
+#  else
                LeaveCriticalSection(&mutex->lock);
+#  endif
 #elif (defined(JEMALLOC_OSSPIN))
                OSSpinLockUnlock(&mutex->lock);
 #else