HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
VOLATILE (extension)
Chapter 10 491
VOLATILE (extension)
Provides for data sharing between asynchronous processes.
Syntax
VOLATILE [::]
object-name-list
object-name-list
is a comma-separated list of the following:
variable-name
array-name
common-block-name
Description
It is only necessary to declare an object as VOLATILE when its value may be altered by an
independent asynchronous process or event (for example, a signal handler). All optimization
processes are inhibited for objects with the VOLATILE attribute. Data objects declared as
VOLATILE are addressable by otherwise independent processes.
If an array or common block is declared as VOLATILE, then all of the array elements or
common block variables become VOLATILE. Similarly, use of EQUIVALENCE with a VOLATILE
object implies that any associated object is also volatile.
Examples
INTEGER alarm, trem
EXTERNAL wakeup
COMMON/FLAGS/ialarm
VOLATILE ialarm
trem = ALARM(60,wakeup) ! Set an alarm to execute in 60 seconds
wakeup
IALARM = 0
DO
IF (ialarm.NE.0) EXIT
END DO
SUBROUTINE wakeup
COMMON/flags/ialarm
VOLATILE ialarm
ialarm=1
END