Pragma Lock_Free (GNAT Reference Manual) (original) (raw)
2.103 Pragma Lock_Free ¶
Syntax:
pragma Lock_Free [ (static_boolean_EXPRESSION) ];
This pragma may be specified for protected types or objects. It specifies that the implementation of protected operations must be implemented without locks. Compilation fails if the compiler cannot generate lock-free code for the operations.
The current conditions required to support this pragma are:
- Protected type declarations may not contain entries
- Protected subprogram declarations may not have nonelementary parameters
In addition, each protected subprogram body must satisfy:
- May reference only one protected component
- May not reference nonconstant entities outside the protected subprogram scope
- May not contain address representation items, allocators, or quantified expressions
- May not contain delay, goto, loop, or procedure-call statements
- May not contain exported and imported entities
- May not dereferenced access values
- Function calls and attribute references must be static
If the Lock_Free aspect is specified to be True for a protected unit and the Ceiling_Locking locking policy is in effect, then the run-time actions associated with the Ceiling_Locking locking policy (described in Ada RM D.3) are not performed when a protected operation of the protected unit is executed.