8.2.17 _gfortran_caf_lock — Locking a lock variable

Description:

Acquire a lock on the given image on a scalar locking variable or for the given array element for an array-valued variable. If the aquired_lock is NULL, the function returns after having obtained the lock. If it is non-NULL, then acquired_lock is assigned the value true (one) when the lock could be obtained and false (zero) otherwise. Locking a lock variable which has already been locked by the same image is an error.

Syntax:

void _gfortran_caf_lock (caf_token_t token, size_t index, int image_index, int *aquired_lock, int *stat, char *errmsg, size_t errmsg_len)

Arguments:
token intent(in) An opaque pointer identifying the coarray.
index intent(in) Array index; first array index is 0. For scalars, it is always 0.
image_index intent(in) The ID of the remote image; must be a positive number.
aquired_lock intent(out) If not NULL, it returns whether lock could be obtained.
stat intent(out) Stores the STAT=; may be NULL.
errmsg intent(out) When an error occurs, this will be set to an error message; may be NULL.
errmsg_len intent(in) the buffer size of errmsg
NOTES

This function is also called for critical blocks; for those, the array index is always zero and the image index is one. Libraries are permitted to use other images for critical-block locking variables.

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gfortran/_005fgfortran_005fcaf_005flock.html