]>
Commit | Line | Data |
---|---|---|
213516ef | 1 | -- Copyright 2020-2023 Free Software Foundation, Inc. |
32fa152e TT |
2 | -- |
3 | -- This program is free software; you can redistribute it and/or modify | |
4 | -- it under the terms of the GNU General Public License as published by | |
5 | -- the Free Software Foundation; either version 3 of the License, or | |
6 | -- (at your option) any later version. | |
7 | -- | |
8 | -- This program is distributed in the hope that it will be useful, | |
9 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | -- GNU General Public License for more details. | |
12 | -- | |
13 | -- You should have received a copy of the GNU General Public License | |
14 | -- along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | with Pkg; use Pkg; | |
17 | with System; | |
18 | ||
19 | procedure Prot is | |
20 | ||
21 | protected type Obj_Type | |
22 | (Ceiling_Priority: System.Priority := System.Priority'Last) | |
23 | with Priority => Ceiling_Priority | |
24 | is | |
25 | procedure Set (V : Integer); | |
26 | function Get return Integer; | |
27 | private | |
28 | Local : Integer := 0; | |
29 | end Obj_Type; | |
30 | ||
31 | protected body Obj_Type is | |
32 | procedure Set (V : Integer) is | |
33 | begin | |
34 | Local := V; -- STOP | |
35 | end Set; | |
36 | ||
37 | function Get return Integer is | |
38 | begin | |
39 | return Local; | |
40 | end Get; | |
41 | end Obj_Type; | |
42 | ||
43 | Obj : Obj_Type; | |
44 | begin | |
45 | Obj.Set (5); | |
46 | Pkg.Do_Nothing(Obj'Address); | |
47 | end Prot; |