#pragma omp threadprivate

Description

The omp threadprivate directive makes the named file-scope, namespace-scope, or static block-scope variables private to a thread.

Syntax

#pragma omp threadprivate (list)

where list is a comma-separated list of variables.

Notes

Each copy of an omp threadprivate data variable is initialized once prior to first use of that copy. If an object is changed before being used to initialize a threadprivate data variable, behavior is unspecified.

A thread must not reference another thread's copy of an omp threadprivate data variable. References will always be to the master thread's copy of the data variable when executing serial and master regions of the program.

Use of the omp threadprivate directive is governed by the following points:

Related References

Pragmas to Control Parallel Processing IBM Copyright 2003