DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B3021: protected object's ceiling below its caller's priority

Catalog status: active. Default severity: error. Stable name: ceiling-violation. Family: Flow and effects.

Under Jorvik's ceiling locking (RM D.3), a protected action runs at its object's ceiling priority, the highest priority any of its callers may have. A task whose priority is higher than the ceiling of an object it uses (the main subprogram has the default priority, 48), or a protected action that uses another object with a lower ceiling, breaks the rule; Ada reports it with Program_Error at run time, and Verada at compile time. A protected object's ceiling is its Priority aspect, or 97 by default.

Example (Vada)

   protected Store with Priority => 10 is
      procedure Put (X : Integer);
   private
      Value : Integer := 0;
   end Store;

   task Urgent with Priority => 20;   --  its body calls Store.Put

Example (Varc)

    pub protected Store @Priority(10) {
        fn Put(X: Integer);
        private var Value: Integer = 0;
    }

    pub task Urgent @Priority(20);   // its body calls Store.Put

What to do

Raise the object's ceiling to at least the highest priority of its callers, or lower the caller's priority.

Regression source and further reading

Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.

See flow and effects, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.