EVENT_QUERY — Query whether a coarray event has occurred#
-
EVENT_QUERY(EVENT, COUNT, STAT)#
EVENT_QUERY
assignes the number of events toCOUNT
which have been posted to theEVENT
variable and not yet been removed by callingEVENT WAIT
. WhenSTAT
is present and the invocation was successful, it is assigned the value 0. If it is present and the invocation has failed, it is assigned a positive value andCOUNT
is assigned the value -1.- Parameters:
EVENT – (intent(IN)) Scalar of type
EVENT_TYPE
, defined inISO_FORTRAN_ENV
; shall not be coindexed.COUNT – (intent(out))Scalar integer with at least the precision of default integer.
STAT – (optional) Scalar default-kind integer variable.
- Standard:
TS 18508 or later
- Class:
subroutine
- Syntax:
CALL EVENT_QUERY (EVENT, COUNT [, STAT])
- Example:
program atomic use iso_fortran_env implicit none type(event_type) :: event_value_has_been_set[*] integer :: cnt if (this_image() == 1) then call event_query (event_value_has_been_set, cnt) if (cnt > 0) write(*,*) "Value has been set" elseif (this_image() == 2) then event post (event_value_has_been_set[1]) end if end program atomic