Share via


NdisInterlockedAddUlong (Compact 2013)

3/26/2014

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

Syntax

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

Parameters

  • Addend
    [in] Points to the variable for which the value is to be adjusted by the given Increment.
  • Increment
    [in] Specifies the value to be added to that at Addend.
  • SpinLock
    [in] Points to a caller-initialized spin lock.

Return Value

None.

Remarks

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

The SpinLock passed to NdisInterlockedAddUlong is used to make sure that the addition to the variable at Addend is atomic with regard to any other operations on the same variable that synchronize with the same spin lock.

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

Requirements

Header

ndis.h

Library

ndis.lib

See Also

Reference

NDIS Interlocked Functions Interface
NdisAcquireSpinLock
NdisAllocateSpinLock
NdisReleaseSpinLock
NdisRetrieveUlong
NdisStoreUlong