| Name: firstprivate | Properties: data-environment attribute, data-sharing attribute, privatization |
|
|
Arguments
| Name | Type | Properties |
| list | list of variable list item type | |
|
|
Directives
, , , , , , , , , ,Semantics
The firstprivate clause provides a superset of the functionality provided by the private clause. A list item that appears in a firstprivate clause is subject to the private clause semantics described in Section 5.4.3, except as noted. In addition, the new list item is initialized from the original list item that exists before the construct. The initialization of the new list item is done once for each task that references the list item in any statement in the construct. The initialization is done prior to the execution of the construct.For a firstprivate clause on a construct that is not a work-distribution construct, the initial value of the new list item is the value of the original list item that exists immediately prior to the construct in the task region where the construct is encountered unless otherwise specified. For a firstprivate clause on a work-distribution construct, the initial value of the new list item for each implicit task of the threads that execute the construct is the value of the original list item that exists in the implicit task immediately prior to the point in time that the construct is encountered unless otherwise specified.
To avoid data races, concurrent updates of the original list item must be synchronized with the read of the original list item that occurs as a result of the firstprivate clause.
If copy constructors are called, the order in which copy constructors for different variables of class type are called is unspecified.
If the original list item has the POINTER attribute, the new list items receive the same association status as the original list item, as if by pointer assignment.
The list items that appear in a firstprivate clause may include named constants.
Restrictions
Restrictions to the firstprivate clause are as follows:A list item that appears in a reduction clause of a worksharing construct must not appear in a firstprivate clause in a task construct encountered during execution of any of the worksharing regions that arise from the worksharing construct.
Cross References