NPA_SpinTryLockDisable

Tries to acquire a specified spin lock without spin waiting to allow multiprocessor (MP) safe operations on shared data.

Thread Context:Non-Blocking

Syntax

    LONG NPA_SpinTryLockDisable (
       LONG  *lockStatus,
       LONG  *CPUFlags);
    
    

Parameters

lockStatus
(IN) Address of the spin lock to be initialized.
CPUFlags
(IN) Address of the location where processor flags (state prior disabling interrupts) are saved if lock is successfully acquired.

Return Values

The following table lists return values and descriptions.

0

Successfully acquired lock.

1

Busy. Unable to acquire lock.

Remarks

NPA_SpinTryLockDisable disables interrupts on the currently processor only.

This disable form of the spin lock should be used in the process time code when code is used by both process time and interrupt time to avoid deadlocks with the interrupt time code.

Must be initialized using NPA_SpinLockInit before using it.

NPA_SpinTryLockDisable tries to acquire a specified spin lock without waiting and automatically disables interrupts only if lock is successfully acquired.

A TryLock can be used to avoid deadlocks.