ATOMIC_FETCH_ADD intrinsic subroutine

Standard: F77 F90 F95 F2003 F2008 F2018 Example program



ATOM : scalar Integer(atomic_int_kind), Intent(InOut), must be a coarray or a coindexed object;
VALUE : scalar Integer;
OLD : scalar Integer(atomic_int_kind), Intent(Out);
STAT : scalar Integer, not a coindexed object, Intent(Out). STAT must be able to represent the values −9999 to +9999 (i.e. 16 bits or larger).


The variable ATOM is atomically assigned the value of ATOM+VALUE, without regard to the segment rules, and OLD is assigned the value that ATOM had immediately before the operation. If STAT is present, it is assigned a positive value if an error occurs, and zero otherwise. If an error occurs and STAT is not present, the program is terminated.

Note that VALUE is not required to have the same kind as ATOM; however, the values of VALUE and ATOM+VALUE must be representable in atomic_int_kind.

If ATOM is a coindexed variable that lies on a failed image, the error STAT_FAILED_IMAGE occurs.


ATOMIC_ADD intrinsic subroutine, ATOMIC_CAS intrinsic subroutine, ATOMIC_DEFINE intrinsic subroutine, ATOMIC_FETCH_AND intrinsic subroutine, ATOMIC_FETCH_OR intrinsic subroutine, ATOMIC_FETCH_XOR intrinsic subroutine, ATOMIC_REF intrinsic subroutine, CODIMENSION attribute, Image selectors