]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
1 | .. |
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. | |
5 | ||
6 | .. index:: ATOMIC_FETCH_AND, Atomic subroutine, AND with fetch | |
7 | ||
8 | .. _atomic_fetch_and: | |
9 | ||
10 | ATOMIC_FETCH_AND --- Atomic bitwise AND operation with prior fetch | |
11 | ****************************************************************** | |
12 | ||
13 | .. function:: ATOMIC_FETCH_AND (ATOM, VALUE, OLD , STAT) | |
14 | ||
15 | ``ATOMIC_AND(ATOM, VALUE)`` atomically stores the value of :samp:`{ATOM}` in | |
16 | :samp:`{OLD}` and defines :samp:`{ATOM}` with the bitwise AND between the values of | |
17 | :samp:`{ATOM}` and :samp:`{VALUE}`. When :samp:`{STAT}` is present and the invocation was | |
18 | successful, it is assigned the value 0. If it is present and the invocation has | |
19 | failed, it is assigned a positive value; in particular, for a coindexed | |
20 | :samp:`{ATOM}`, if the remote image has stopped, it is assigned the value of | |
21 | ``ISO_FORTRAN_ENV`` 's ``STAT_STOPPED_IMAGE`` and if the remote image has | |
22 | failed, the value ``STAT_FAILED_IMAGE``. | |
23 | ||
24 | :param ATOM: | |
25 | Scalar coarray or coindexed variable of integer | |
26 | type with ``ATOMIC_INT_KIND`` kind. | |
27 | ||
28 | :param VALUE: | |
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}`. | |
31 | ||
32 | :param OLD: | |
33 | Scalar of the same type and kind as :samp:`{ATOM}`. | |
34 | ||
35 | :param STAT: | |
36 | (optional) Scalar default-kind integer variable. | |
37 | ||
38 | Standard: | |
39 | TS 18508 or later | |
40 | ||
41 | Class: | |
42 | Atomic subroutine | |
43 | ||
44 | Syntax: | |
45 | .. code-block:: fortran | |
46 | ||
47 | CALL ATOMIC_FETCH_AND (ATOM, VALUE, OLD [, STAT]) | |
48 | ||
49 | Example: | |
50 | .. code-block:: fortran | |
51 | ||
52 | program atomic | |
53 | use iso_fortran_env | |
54 | integer(atomic_int_kind) :: atom[*], old | |
55 | call atomic_fetch_and (atom[1], int(b'10100011101'), old) | |
56 | end program atomic | |
57 | ||
58 | See also: | |
59 | :ref:`ATOMIC_DEFINE`, | |
60 | :ref:`ATOMIC_AND`, | |
61 | :ref:`ISO_FORTRAN_ENV`, | |
62 | :ref:`ATOMIC_FETCH_ADD`, | |
63 | :ref:`ATOMIC_FETCH_OR`, | |
3ed1b4ce | 64 | :ref:`ATOMIC_FETCH_XOR` |