NdisInterlockedAddUlong function

The NdisInterlockedAddUlong function adds an unsigned long value to a given unsigned integer as an atomic operation, using a caller-supplied spin lock to synchronize access to the integer variable.

Syntax


VOID NdisInterlockedAddUlong(
  _In_  PULONG Addend,
  _In_  ULONG Increment,
  _In_  PNDIS_SPIN_LOCK SpinLock
);

Parameters

Addend [in]

A pointer to the variable for which the value is to be adjusted by the given Increment .

Increment [in]

The value to be added to that at Addend .

SpinLock [in]

A pointer to a caller-initialized spin lock.

Return value

None

Remarks

The caller of NdisInterlockedAddUlong must provide resident storage for the spin lock, which must be initialized with the NdisAllocateSpinLock function before the initial call to NdisInterlockedAddUlong.

The SpinLock value that is passed to the NdisInterlockedAddUlong function is used to assure that the addition to the variable at the Addend parameter is atomic with respect to any other operations on the same variable that synchronize with the same spin lock.

NdisInterlockedAddUlong raises the IRQL to DISPATCH_LEVEL when it acquires the given spin lock and restores the original IRQL before it returns control. Consequently, any driver function that calls NdisInterlockedAddUlong cannot be pageable code.

Requirements

Version

Supported for NDIS 6.0 and NDIS 5.1 drivers (see NdisInterlockedAddUlong (NDIS 5.1)) in Windows Vista. Supported for NDIS 5.1 drivers (see NdisInterlockedAddUlong (NDIS 5.1)) in Windows XP.

Header

Ndis.h (include Ndis.h)

IRQL

Any level

See also

NdisAcquireSpinLock
NdisAllocateSpinLock
NdisReleaseSpinLock
NdisRetrieveUlong
NdisStoreUlong

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft