mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:35:41 +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,8 +298,19 @@ AcpiOsAcquireMutex(
|
||||||
return AE_BAD_PARAMETER;
|
return AE_BAD_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExAcquireFastMutex((PFAST_MUTEX)Handle);
|
/* 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;
|
return AE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,8 +388,18 @@ AcpiOsWaitSemaphore(
|
||||||
DPRINT1("Bad parameter\n");
|
DPRINT1("Bad parameter\n");
|
||||||
return AE_BAD_PARAMETER;
|
return AE_BAD_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeAcquireSpinLock(&Sem->Lock, &OldIrql);
|
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)
|
while (Sem->CurrentUnits < Units)
|
||||||
{
|
{
|
||||||
KeReleaseSpinLock(&Sem->Lock, OldIrql);
|
KeReleaseSpinLock(&Sem->Lock, OldIrql);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue