9.92. EVENT_QUERY

9.92 EVENT_QUERY — Query whether a coarray event has occurred

Description:
EVENT_QUERY assignes the number of events to COUNT which have been posted to the EVENT variable and not yet been removed by calling EVENT WAIT. When STAT is present and the invokation was successful, it is assigned the value 0. If it is present and the invokation has failed, it is assigned a positive value and COUNT is assigned the value -1.
Standard:
TS 18508 or later
Class:
subroutine
Syntax:
CALL EVENT_QUERY (EVENT, COUNT [, STAT])
Arguments:
EVENT (intent(IN)) Scalar of type EVENT_TYPE, defined in ISO_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.
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

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

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部