(j3.2006) Public Comment J32034

Aleksandar Donev donev1
Mon Jul 14 12:49:25 EDT 2008


Hi,

> Instead of a CRITICAL construct, I think that CRITICAL
> should be a keyword like PURE or RECURSIVE (and such) that
> applied to procedure declarations.  Similarly, it should
> be an optional keyword on the new BLOCK construct:
> 
> block-stmt is [ block-construct-name : ] [ CRITICAL ] BLOCK
Or, how about

BLOCK
    declare local entities
    CRITICAL

    END CRITICAL
END BLOCK

Why is merging the two blocks better? The only thing I can think of is 
that the stack will not be grown if another image is already executing 
the block. Is this the point?

There may be some issues here about the fact that it is not well-defined 
when execution of declarations (example, allocation, evaluation of 
specification expressions, etc.) occurs, so saying a CRITICAL BLOCK or 
SUBROUTINES cannot begin execution if another one is already executing 
one might be ambiguous and cause undefined behavior. For example:

INTEGER :: N=0

CRITICAL BLOCK
   REAL :: A(N)
   N=N+1
END CRITICAL

Does each image get a local array A of a different size (one larger 
every time the critical block is executed)?

Best,
Aleks



More information about the J3 mailing list