ATOMIC_REF intrinsic subroutine

Standard: F77 F90 F95 F2003 F2008 F2018 Example program



VALUE : scalar, same type and kind as ATOM;
ATOM : scalar Integer(atomic_int_kind) or Logical(atomic_logical_kind), Intent(In), must be a coarray or a coindexed object;
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 referenced, and its value assigned to VALUE, without regard to the segment rules. Note that the assignment to VALUE is not atomic, only the reference to ATOM executes atomically. 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; if it is smaller, the value of ATOM must be one that will fit into VALUE (e.g. if VALUE is a 16-bit integer, the value of ATOM must not be outside the range −32768 to +32767).

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


ATOMIC_DEFINE intrinsic subroutine, CODIMENSION attribute, Image selectors