The GNU Fortran Compiler: _gfortran_caf_atomic_op

Next: _gfortran_caf_co_broadcast, Previous: _gfortran_caf_atomic_cas, Up: Function ABI Documentation [Contents][Index]

#### 8.2.31 `_gfortran_caf_atomic_op` — Atomic operation

Description:

  Apply an operation atomically to an atomic integer or logical variable. After the operation, old contains the value just before the operation, which, respectively, adds (GFC_CAF_ATOMIC_ADD) atomically the `value` to the atomic integer variable or does a bitwise AND, OR or exclusive OR between the atomic variable and value; the result is then stored in the atomic variable.

Syntax:

  `void _gfortran_caf_atomic_op (int op, caf_token_t token, size_t offset, int image_index, void *value, void *old, int *stat, int type, int kind)`

Arguments:

  op | intent(in) the operation to be performed; possible values `GFC_CAF_ATOMIC_ADD` (1), `GFC_CAF_ATOMIC_AND` (2), `GFC_CAF_ATOMIC_OR` (3), `GFC_CAF_ATOMIC_XOR` (4).
  token | intent(in) An opaque pointer identifying the coarray.
  offset | intent(in) By which amount of bytes the actual data is shifted compared to the base address of the coarray.
  image_index | intent(in) The ID of the remote image; must be a positive number; zero indicates the current image when used noncoindexed.
  old | intent(out) The value which the atomic variable had just before the atomic operation.
  val | intent(in) The new value for the atomic variable, assigned to the atomic variable, if `compare` equals the value of the atomic variable.
  stat | intent(out) Stores the status STAT= and may be NULL.
  type | intent(in) the data type, i.e. `BT_INTEGER` (1) or `BT_LOGICAL` (2)
  kind | intent(in) the kind value (only 4; always `int`)