ATOMIC_DEFINE intrinsic subroutine

Standard: F77 F90 F95 F2003 F2008 F2018 Example program


<Syntax>

CALL ATOMIC_DEFINE(ATOM, VALUE [ , STAT ] )

ATOM : scalar Integer(atomic_int_kind) or Logical(atomic_logical_kind), Intent(Out), must be a coarray or a coindexed object;
VALUE : scalar, same type as ATOM;
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).

<Semantics>

The variable ATOM is atomically assigned the value of VALUE, without regard to the segment rules. 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 value of VALUE must be representable in atomic_int_kind (e.g. if atomic_int_kind specifies 32 bits and VALUE is a 64-bit integer, the value of VALUE must not be outside the range −2147483648 to +2147483647).

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

<Related>

ATOMIC_REF intrinsic subroutine, CODIMENSION attribute, Image selectors