зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 3802f86e1bd1 (bug 1364624) for shutdown hangs on reftests. a=backout
This commit is contained in:
Родитель
78dbe34925
Коммит
7652908dea
|
@ -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*
|
||||
|
|
Загрузка…
Ссылка в новой задаче