_gfortran_caf_register
— Registering coarraysSAVE
attribute and using an
explicit ALLOCATE
statement. If an error occurs and STAT is a
NULL
pointer, the function shall abort with printing an error message
and starting the error termination. If no error occurs and STAT is
present, it shall be set to zero. Otherwise, it shall be set to a positive
value and, if not-NULL
, ERRMSG shall be set to a string describing
the failure. The function shall return a pointer to the requested memory
for the local image as a call to malloc
would do.
For CAF_REGTYPE_COARRAY_STATIC
and CAF_REGTYPE_COARRAY_ALLOC
,
the passed size is the byte size requested. For CAF_REGTYPE_LOCK_STATIC
,
CAF_REGTYPE_LOCK_ALLOC
and CAF_REGTYPE_CRITICAL
it is the array
size or one for a scalar.
void *caf_register (size_t size, caf_register_t type, caf_token_t *token,
int *stat, char *errmsg, int errmsg_len)
size | For normal coarrays, the byte size of the coarray to be
allocated; for lock types and event types, the number of elements.
|
type | one of the caf_register_t types.
|
token | intent(out) An opaque pointer identifying the coarray.
|
stat | intent(out) For allocatable coarrays, 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 | the buffer size of errmsg.
|
For normal coarrays, the returned pointer is used for accesses on the local
image. For lock types, the value shall only used for checking the allocation
status. Note that for critical blocks, the locking is only required on one
image; in the locking statement, the processor shall always pass always an
image index of one for critical-block lock variables
(CAF_REGTYPE_CRITICAL
). For lock types and critical-block variables,
the initial value shall be unlocked (or, respecitively, not in critical
section) such as the value false; for event types, the initial state should
be no event, e.g. zero.