ExInterlockedAddLargeInteger

LARGE_INTEGER
    ExInterlockedAddLargeInteger(

        IN PLARGE_INTEGER  Addend,
        IN LARGE_INTEGER  Increment,
        IN PKSPIN_LOCK  Lock
        );

ExInterlockedAddLargeInteger adds a large integer value to a given addend as an atomic operation.

Parameters

Addend
Points to a large integer to be adjusted by the Increment value.
Increment
Specifies a value to be added to Addend.
Lock
Points to a spin lock to be used to synchronize access to Addend.

Return Value

ExInterlockedAddLargeInteger returns the initial value of the Addend.

Comments

Support routines that do interlocked operations are assumed to be incapable of causing a page fault. That is, neither their code nor any of the data they touch can cause a page fault without bringing down the system. They use spin locks to achieve atomicity in SMP machines. The caller must provide resident storage for the Lock, which must be initialized with KeInitializeSpinLock before the initial call to an ExInterlockedXxx.

The Lock passed to ExInterlockedAddLargeInteger is used to assure that the add operation on Addend is atomic with respect to any other operations on the same value which synchronize with this same spin lock.

ExInterlockedAddLargeInteger masks interrupts. Consequently, it can be used for synchronization between an ISR and other device driver code, provided that the same Lock is never reused in a call to a routine that runs at IRQL DISPATCH_LEVEL.

Note that calls to InterlockedXxxxxxx are guaranteed to be atomic with respect to other InterlockedXxxxxx calls without caller supplied spin locks.

Callers of ExInterlockedAddLargeInteger run at any IRQL.

See Also

ExInterlockedAddUlong, InterlockedIncrement, InterlockedDecrement, KeInitializeSpinLock