ASYNCHRONOUS

Statement and Attribute: Specifies that a variable can be used for asynchronous input and output.

The ASYNCHRONOUS attribute can be specified in a type declaration statement or an ASYNCHRONOUS statement, and takes one of the following forms:

Syntax

Type Declaration Statement:


type, [att-ls,] ASYNCHRONOUS [att-ls,] :: var [, var] ...


Statement:


ASYNCHRONOUS [::] var [, var] ...


type
Is a data type specifier.


att-ls
Is an optional list of attribute specifiers.


var
Is the name of a variable.

Description

Asynchronous I/O, or non-blocking I/O, allows a program to continue processing data while the I/O operation is performed in the background.

A variable can have the ASYNCHRONOUS attribute in a particular scoping unit without necessarily having it in other scoping units. If an object has the ASYNCHRONOUS attribute, then all of its subobjects also have the ASYNCHRONOUS attribute.

The ASYNCHRONOUS attribute can also be conferred implicitly by the use of a variable in data transfer statements READ and WRITE and file operation I/O statements OPEN and INQUIRE.

See Also

Type Declarations, Compatible attributes

Examples

The following example shows how the ASYNCHRONOUS attribute can be applied in an OPEN and READ statement.

program test
integer, asynchronous, dimension(100) :: array
open (unit=1,file='asynch.dat',asynchronous='YES',&
  form='unformatted')
write (1) (i,i=1,100)
rewind (1)
read (1,asynchronous='YES') array
wait(1)
write (*,*) array(1:10)
end