mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[ACPI]
- Fix implementations of AcpiOsWaitSemaphore and AcpiOsAcquireMutex to obey the caller's demands to not block if requested svn path=/trunk/; revision=56245
This commit is contained in:
parent
d45f75426f
commit
ba5509bc72
1 changed files with 24 additions and 3 deletions
|
@ -298,7 +298,18 @@ AcpiOsAcquireMutex(
|
|||
return AE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
/* Check what the caller wants us to do */
|
||||
if (Timeout == ACPI_DO_NOT_WAIT)
|
||||
{
|
||||
/* Try to acquire without waiting */
|
||||
if (!ExTryToAcquireFastMutex((PFAST_MUTEX)Handle))
|
||||
return AE_TIME;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Block until we get it */
|
||||
ExAcquireFastMutex((PFAST_MUTEX)Handle);
|
||||
}
|
||||
|
||||
return AE_OK;
|
||||
}
|
||||
|
@ -379,6 +390,16 @@ AcpiOsWaitSemaphore(
|
|||
}
|
||||
|
||||
KeAcquireSpinLock(&Sem->Lock, &OldIrql);
|
||||
|
||||
/* Make sure we can wait if we have fewer units than we need */
|
||||
if ((Timeout == ACPI_DO_NOT_WAIT) && (Sem->CurrentUnits < Units))
|
||||
{
|
||||
/* We can't so we must bail now */
|
||||
KeReleaseSpinLock(&Sem->Lock, OldIrql);
|
||||
return AE_TIME;
|
||||
}
|
||||
|
||||
/* Time to block until we get enough units */
|
||||
while (Sem->CurrentUnits < Units)
|
||||
{
|
||||
KeReleaseSpinLock(&Sem->Lock, OldIrql);
|
||||
|
|
Loading…
Reference in a new issue