gnatprove_13.2.1_28fc3583/share/examples/spark/adacore_u/Concurrency/protected_objects.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
with Ada.Interrupts.Names; use Ada.Interrupts.Names;
with System;

package Protected_Objects
  with SPARK_Mode
is
   protected P1 with
     Interrupt_Priority => System.Interrupt_Priority'First
   is
      procedure Set (V : Natural);
      function Get return Natural;
      entry Reset;
      procedure Signal with Attach_Handler => SIGINT;
   private
      The_Data : Natural := 0;
   end P1;

   protected type PT with
     Interrupt_Priority => System.Interrupt_Priority'First
   is
      procedure Set (V : Natural);
      function Get return Natural;
      entry Reset;
      procedure Signal with Attach_Handler => SIGINT;
   private
      The_Data : Natural := 0;
   end PT;
   P2 : PT;

   type PA is array (1 .. 3) of PT;
   P3 : PA;

   type PR is record
      A, B : PT;
   end record with Volatile;
   P4 : PR;

end Protected_Objects;