# ATOMIC_ADD

Atomic Intrinsic Subroutine (Generic): Performs atomic addition.

CALL ATOMIC_ADD (atom, value [, stat])

atom | (Input; output) Must be a scalar coarray or coindexed object and of type integer with kind ATOMIC_INT_KIND. It becomes defined with the value of atom + value if no error occurs. Otherwise, it becomes undefined. ATOMIC_INT_KIND is a named constant in the intrinsic module ISO_FORTRAN_ENV.
value | (Input) Must be a scalar integer. The value of value and value + atom must be representable as integers with kind ATOMIC_INT_KIND.
stat | (Output; optional) Must be a non-coindexed integer scalar with a decimal exponent range of at least four (KIND=2 or greater). The value assigned to stat is specified in Overview of Atomic Subroutines. If stat is not present and an error condition occurs, error termination is initiated.

## Example

Consider the following:

    CALL ATOMIC_ADD (N[12], 7)

If N on image 12 is 4 when this operation is initiated, the value of N on image 12 is defined with the value 11 when the operation is complete and no error occurs during the subroutine reference.

Parent topic: A to B

## See Also

Overview of Atomic Subroutines
ISO_FORTRAN_ENV Module