prot.adb 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. -- Copyright 2020-2022 Free Software Foundation, Inc.
  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. with Pkg; use Pkg;
  16. with System;
  17. procedure Prot is
  18. protected type Obj_Type
  19. (Ceiling_Priority: System.Priority := System.Priority'Last)
  20. with Priority => Ceiling_Priority
  21. is
  22. procedure Set (V : Integer);
  23. function Get return Integer;
  24. private
  25. Local : Integer := 0;
  26. end Obj_Type;
  27. protected body Obj_Type is
  28. procedure Set (V : Integer) is
  29. begin
  30. Local := V; -- STOP
  31. end Set;
  32. function Get return Integer is
  33. begin
  34. return Local;
  35. end Get;
  36. end Obj_Type;
  37. Obj : Obj_Type;
  38. begin
  39. Obj.Set (5);
  40. Pkg.Do_Nothing(Obj'Address);
  41. end Prot;