Backed out changeset 3802f86e1bd1 (bug 1364624) for shutdown hangs on reftests. a=backout

This commit is contained in:
Dorel Luca 2018-04-26 00:27:45 +03:00
Родитель 78dbe34925
Коммит 7652908dea
3 изменённых файлов: 23 добавлений и 8 удалений

Просмотреть файл

@ -54,8 +54,8 @@ mozilla::detail::ConditionVariableImpl::notify_all()
void
mozilla::detail::ConditionVariableImpl::wait(MutexImpl& lock)
{
SRWLOCK* srwlock = &lock.platformData()->lock;
bool r = SleepConditionVariableSRW(&platformData()->cv_, srwlock, INFINITE, 0);
CRITICAL_SECTION* cs = &lock.platformData()->criticalSection;
bool r = SleepConditionVariableCS(&platformData()->cv_, cs, INFINITE);
MOZ_RELEASE_ASSERT(r);
}
@ -68,7 +68,7 @@ mozilla::detail::ConditionVariableImpl::wait_for(MutexImpl& lock,
return CVStatus::NoTimeout;
}
SRWLOCK* srwlock = &lock.platformData()->lock;
CRITICAL_SECTION* cs = &lock.platformData()->criticalSection;
// Note that DWORD is unsigned, so we have to be careful to clamp at 0. If
// rel_time is Forever, then ToMilliseconds is +inf, which evaluates as
@ -89,7 +89,7 @@ mozilla::detail::ConditionVariableImpl::wait_for(MutexImpl& lock,
}
}
BOOL r = SleepConditionVariableSRW(&platformData()->cv_, srwlock, msec, 0);
BOOL r = SleepConditionVariableCS(&platformData()->cv_, cs, msec);
if (r)
return CVStatus::NoTimeout;
MOZ_RELEASE_ASSERT(GetLastError() == ERROR_TIMEOUT);

Просмотреть файл

@ -13,7 +13,7 @@
struct mozilla::detail::MutexImpl::PlatformData
{
SRWLOCK lock;
CRITICAL_SECTION criticalSection;
};
#endif // MutexPlatformData_windows_h

Просмотреть файл

@ -14,23 +14,38 @@
mozilla::detail::MutexImpl::MutexImpl()
{
InitializeSRWLock(&platformData()->lock);
// This number was adopted from NSPR.
const static DWORD LockSpinCount = 1500;
#if defined(RELEASE_OR_BETA)
// Vista and later automatically allocate and subsequently leak a debug info
// object for each critical section that we allocate unless we tell the
// system not to do that.
DWORD flags = CRITICAL_SECTION_NO_DEBUG_INFO;
#else
DWORD flags = 0;
#endif // defined(RELEASE_OR_BETA)
BOOL r = InitializeCriticalSectionEx(&platformData()->criticalSection,
LockSpinCount, flags);
MOZ_RELEASE_ASSERT(r);
}
mozilla::detail::MutexImpl::~MutexImpl()
{
DeleteCriticalSection(&platformData()->criticalSection);
}
void
mozilla::detail::MutexImpl::lock()
{
AcquireSRWLockExclusive(&platformData()->lock);
EnterCriticalSection(&platformData()->criticalSection);
}
void
mozilla::detail::MutexImpl::unlock()
{
ReleaseSRWLockExclusive(&platformData()->lock);
LeaveCriticalSection(&platformData()->criticalSection);
}
mozilla::detail::MutexImpl::PlatformData*