__smp_dec4 -- Decrement 4 Byte Signed Integer Atomically

Format

#include <builtin.h>
int __smp_dec4(int *pNum)

Language Level: None
__smp_dec4 decrements a signed integer in memory at address pNum. This operation is atomic even on multi-processor machines.

Return Value
The return value indicates whether the decremented value is negative, zero, or positive by returning -1, 0, or 1 respectively.

Example
This example decrements the value of mem.

#include <stdio.h>
#include <builtin.h>
int mem = 1;
int main(void)
{
   if (!__smp_dec4(&mem))
   {
      printf("The memory location is now zero.");
   }
   /****************************************
      The output should be:
      The memory location is now zero.
   ****************************************/
   return 0;
}


__dec4 -- Decrement 4 Byte Signed Integer
__inc4 -- Increment 4 Byte Signed Integer
__smp_inc4 -- Increment 4 Byte Signed Integer Atomically