prev   Menu   next

Mutual Exclusion

SEIZE~END SEIZE
A SEIZE~END SEIZE block avoids any other parallel activitiy executes the included statements.

SEIZE SHARED
A SEIZE statment designates the shared ports that shall be protected.
EXAMPLE.

DECLARE SHARED S1(0 TO 1) OF STRUCT1
……
SEIZE SHARED S1
PUT TO S1(0) FROM …
PUT TO S1(1) FROM …
END SEIZE

If no SEIZE, s1(0) and s1(1) may be wirtten by different parallel activities.

Note 1.
No nested SEIZE Block is allowed.
But two or more shared ports can be designated in a SEIZE line as follows:

SEIZE SHARED s1, SHARED s2, SHARED s3

Note 2.
A single PUT TO or RECEIVE FROM statement not within a SEIZE block is protected by the implicit seize block.
But This does not apply for a PUT TO or RECEIVE FROM statment within a SEIZE Block.
Thus when a SEIZE block is used, all SHARED ports within it should be disignated in the SEIZE line.

SEIZE user_defined_name
A SEIZE statement can consist of a user defined name.
In such case, only one parallel activity executes on the blocks of the same name.
Example.

SEIZE ColorPoints
SET POINT COLOR n
PLOT POINTS: x,y
END SEIZE

The above SEIZE block avoids any other parallel activity executes SET POINT COLOR before execution of PLOT POINTS.
If SEIZE omiited, PLOT POINTS may draw with a color disignated by another parallel activity.