test: intrloc2.c File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# intrloc2.c File Reference

`#include "exp.h"`

Go to the source code of this file.

## Functions

INTERLOCKED_RESULT | ExInterlockedIncrementLong (IN PLONG Addend, IN PKSPIN_LOCK Lock)
INTERLOCKED_RESULT | ExInterlockedDecrementLong (IN PLONG Addend, IN PKSPIN_LOCK Lock)

## Function Documentation

INTERLOCKED_RESULT ExInterlockedDecrementLong | ( | IN PLONG | Addend,
|  | IN PKSPIN_LOCK | Lock
| ) |

Definition at line 75 of file intrloc2.c.

References ExInterlockedAddUlong(), and Lock.

Referenced by main().

    00082                    :
    00083
    00084     This function atomically decrements Addend, returning an ennumerated
    00085     type which indicates what interesting transitions in the value of
    00086     Addend occurred due the operation.
    00087
    00088 Arguments:
    00089
    00090     Addend - Pointer to variable to decrement.
    00091
    00092     Lock - Spinlock used to implement atomicity.
    00093
    00094 Return Value:
    00095
    00096     An ennumerated type:
    00097
    00098     ResultNegative if Addend is < 0 after decrement.
    00099     ResultZero     if Addend is = 0 after decrement.
    00100     ResultPositive if Addend is > 0 after decrement.
    00101
    00102 --*/
    00103
    00104 {
    00105     LONG    OldValue;
    00106
    00107     OldValue = (LONG)ExInterlockedAddUlong((PULONG)Addend, -1, Lock);
    00108
    00109     if (OldValue > 1)
    00110         return ResultPositive;
    00111
    00112     if (OldValue == 1)
    00113         return ResultZero;
    00114
    00115     if (OldValue < 1)
    00116         return ResultNegative;
    00117 }
    }

INTERLOCKED_RESULT ExInterlockedIncrementLong | ( | IN PLONG | Addend,
|  | IN PKSPIN_LOCK | Lock
| ) |

Definition at line 30 of file intrloc2.c.

References ExInterlockedAddUlong(), and Lock.

Referenced by KeUpdateRunTime(), and main().

    00037                    :
    00038
    00039     This function atomically increments Addend, returning an ennumerated
    00040     type which indicates what interesting transitions in the value of
    00041     Addend occurred due the operation.
    00042
    00043 Arguments:
    00044
    00045     Addend - Pointer to variable to increment.
    00046
    00047     Lock - Spinlock used to implement atomicity.
    00048
    00049 Return Value:
    00050
    00051     An ennumerated type:
    00052
    00053     ResultNegative if Addend is < 0 after increment.
    00054     ResultZero     if Addend is = 0 after increment.
    00055     ResultPositive if Addend is > 0 after increment.
    00056
    00057 --*/
    00058
    00059 {
    00060     LONG    OldValue;
    00061
    00062     OldValue = (LONG)ExInterlockedAddUlong((PULONG)Addend, 1, Lock);
    00063
    00064     if (OldValue < -1)
    00065         return ResultNegative;
    00066
    00067     if (OldValue == -1)
    00068         return ResultZero;
    00069
    00070     if (OldValue > -1)
    00071         return ResultPositive;
    00072 }