__smp_inc4 -- Increment 4 Byte Signed Integer Atomically

Format

#include <builtin.h>

int __smp_inc4(int *pNum)

Language Level: None
__smp_inc4 increments 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 incremented value is negative, zero, or positive by returning -1, 0, or 1 respectively.

Example
This example increments the value of mem.

#include <stdio.h>
#include <builtin.h>
int mem = -1;
int main(void)
{
   if (!__smp_inc4(&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_dec4 -- Decrement 4 Byte Signed Integer Atomically