Technical data
#pragma Directives [3]
#pragma _CRI taskcommon variable, ...
Variables that are given a task common storage class are placed in storage so that
each task has a separate copy of the variables; all functions within a task can
access the same copy of the task common variable, but no task can access any
task common variables belonging to another task.
A primary use for task common variables is efficient porting of macrotasked
programs from a shared-memory system (that is, a system, such as VAX, on
which independently executing programs can access the other program’s
memory). On UNICOS and UNICOS/mk systems, independently executing
programs cannot access memory belonging to other programs.
This directive can appear in both global and local scopes and applies only to the
following types of variables:
• Global scope variables, in which case the directive must appear at global
scope.
• Local scope variables with static storage class, in which case the directive
must appear within the same scope as the variable declaration.
When a variable is designated as task common, subsequent declarations of that
variable in the same source file inherit the task common storage class.
In the following example, the declaration of x in fctn is the same x previously
declared to be task common; it, therefore, has task common storage class:
int x;
#pragma _CRI taskcommon x
fctn()
{
extern int x;
}
The taskcommon directive takes precedence over the -h common and
-h taskprivate command line options.
The following restrictions apply to taskcommon variables:
• A taskcommon variable cannot be initialized. (A taskprivate variable
can be initialized, see Section 3.8.8, page 75.) By default, a taskcommon
variable is initialized to 0.
• A taskcommon variable cannot also be a soft external.
S–2179–36 77










