FreeBSD/sys/contrib/dev/acpica/components/executer/exsystem.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiExSystemWaitMutex
 *
 * PARAMETERS:  Mutex           - Mutex to wait on
 *              Timeout         - Max time to wait
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Implements a mutex wait with a check to see if the
 *              mutex is available immediately. If it is not, the
 *              interpreter is released before waiting.
 *
 ******************************************************************************/
AcpiExSystemWaitMutex
PARAMETERS:  Mutex           - Mutex to wait on
Timeout         - Max time to wait

Status

Implements a mutex wait with a check to see if the
mutex is available immediately. If it is not, the
interpreter is released before waiting.
AcpiExSystemWaitMutex PARAMETERS : Mutex - Mutex to wait on Timeout - Max time to wait Status Implements a mutex wait with a check to see if the mutex is available immediately . If it is not the interpreter is released before waiting .
ACPI_STATUS
AcpiExSystemWaitMutex (
    ACPI_MUTEX              Mutex,
    UINT16                  Timeout)
{
    ACPI_STATUS             Status;
    ACPI_FUNCTION_TRACE (ExSystemWaitMutex);
    Status = AcpiOsAcquireMutex (Mutex, ACPI_DO_NOT_WAIT);
    if (ACPI_SUCCESS (Status))
    {
        return_ACPI_STATUS (Status);
    }
    if (Status == AE_TIME)
    {
        AcpiExExitInterpreter ();
        Status = AcpiOsAcquireMutex (Mutex, Timeout);
        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
            "*** Thread awake after blocking, %s\n",
            AcpiFormatException (Status)));
        AcpiExEnterInterpreter ();
    }
    return_ACPI_STATUS (Status);
}
ACPI_STATUS AcpiExSystemWaitMutex ( ACPI_MUTEX Mutex , UINT16 Timeout ) { ACPI_STATUS Status ; ACPI_FUNCTION_TRACE ( ExSystemWaitMutex ) ; Status = AcpiOsAcquireMutex ( Mutex , ACPI_DO_NOT_WAIT ) ; if ( ACPI_SUCCESS ( Status ) ) { return_ACPI_STATUS ( Status ) ; } if ( Status == AE_TIME ) { AcpiExExitInterpreter ( ) ; Status = AcpiOsAcquireMutex ( Mutex , Timeout ) ; ACPI_DEBUG_PRINT ( ( ACPI_DB_EXEC , " \n " , AcpiFormatException ( Status ) ) ) ; AcpiExEnterInterpreter ( ) ; } return_ACPI_STATUS ( Status ) ; }
FUNCTION:    AcpiExSystemWaitMutex
 PARAMETERS:  Mutex           - Mutex to wait on
              Timeout         - Max time to wait
FUNCTION : AcpiExSystemWaitMutex PARAMETERS : Mutex - Mutex to wait on Timeout - Max time to wait
/* We must wait, so unlock the interpreter */ /* Reacquire the interpreter */