### 15.2.2.4 LASTPRIVATE Clause (TU*X only)

The LASTPRIVATE clause provides a superset of the functionality provided by the PRIVATE clause (see Section 15.2.2.5); objects are declared PRIVATE and they are given certain values when the parallel region is exited. It takes the following form:

  LASTPRIVATE (list)
  list
  Is the name of one or more variables or common blocks that are accessible to the scoping unit. Subobjects cannot be specified. Each name must be separated by a comma, and a named common block must appear between slashes (/ /).

Variables that appear in a LASTPRIVATE list are subject to PRIVATE clause semantics. In addition, once the parallel region is exited, each variable has the value provided by the sequentially last section or loop iteration.

When the LASTPRIVATE clause appears in a DO directive, the thread that executes the sequentially last iteration updates the version of the object it had before the construct. When the LASTPRIVATE clause appears in a SECTIONS (or PSECTIONS) directive, the thread that executes the lexically last SECTION updates the version of the object it had before the construct.

Subobjects that are not assigned a value by the last iteration of the DO or the lexically last SECTION of the SECTIONS (or PSECTIONS) directive are undefined after the construct.

Previous Page Next Page Table of Contents