2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. index:: ATOMIC_DEFINE, Atomic subroutine, define
10 ATOMIC_DEFINE --- Setting a variable atomically
11 ***********************************************
13 .. function:: ATOMIC_DEFINE(ATOM, VALUE)
15 ``ATOMIC_DEFINE(ATOM, VALUE)`` defines the variable :samp:`{ATOM}` with the value
16 :samp:`{VALUE}` atomically. When :samp:`{STAT}` is present and the invocation was
17 successful, it is assigned the value 0. If it is present and the invocation
18 has failed, it is assigned a positive value; in particular, for a coindexed
19 :samp:`{ATOM}`, if the remote image has stopped, it is assigned the value of
20 ``ISO_FORTRAN_ENV`` 's ``STAT_STOPPED_IMAGE`` and if the remote image has
21 failed, the value ``STAT_FAILED_IMAGE``.
24 Scalar coarray or coindexed variable of either integer
25 type with ``ATOMIC_INT_KIND`` kind or logical type with
26 ``ATOMIC_LOGICAL_KIND`` kind.
29 Scalar of the same type as :samp:`{ATOM}`. If the kind
30 is different, the value is converted to the kind of :samp:`{ATOM}`.
33 (optional) Scalar default-kind integer variable.
36 Fortran 2008 and later; with :samp:`{STAT}`, TS 18508 or later
42 .. code-block:: fortran
44 CALL ATOMIC_DEFINE (ATOM, VALUE [, STAT])
47 .. code-block:: fortran
51 integer(atomic_int_kind) :: atom[*]
52 call atomic_define (atom[1], this_image())
58 :ref:`ISO_FORTRAN_ENV`,