02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

VOLATILE (extension)<br />

Provides for data sharing between asynchronous processes.<br />

Syntax<br />

VOLATILE [::] object-name-list<br />

object-name-list is a comma-separated list of the following:<br />

Description<br />

variable-name<br />

array-name<br />

common-block-name<br />

<strong>HP</strong> <strong>Fortran</strong> statements<br />

VOLATILE (extension)<br />

It is only necessary to declare an object as VOLATILE when its value may be altered by an<br />

independent asynchronous process or event (for example, a signal handler). All optimization<br />

processes are inhibited for objects with the VOLATILE attribute. Data objects declared as<br />

VOLATILE are addressable by otherwise independent processes.<br />

If an array or common block is declared as VOLATILE, then all of the array elements or<br />

common block variables become VOLATILE. Similarly, use of EQUIVALENCE with a VOLATILE<br />

object implies that any associated object is also volatile.<br />

Examples<br />

INTEGER alarm, trem<br />

EXTERNAL wakeup<br />

COMMON/FLAGS/ialarm<br />

VOLATILE ialarm<br />

trem = ALARM(60,wakeup) ! Set an alarm to execute in 60 seconds<br />

wakeup<br />

IALARM = 0<br />

DO<br />

IF (ialarm.NE.0) EXIT<br />

END DO<br />

SUBROUTINE wakeup<br />

COMMON/flags/ialarm<br />

VOLATILE ialarm<br />

ialarm=1<br />

END<br />

Chapter 10 457

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!