/usr/share/ada/adainclude/gnatcoll/gnatcoll-ravenscar-simple_sporadic_task.ads is in libgnatcoll1.6-dev 1.6gpl2014-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | ------------------------------------------------------------------------------
-- --
-- G N A T C O L L --
-- --
-- Copyright (C) 2008-2014, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- A simple archetype of a Ravenscar-compliant sporadic task. The task is
-- meant to enforce a minimum interelease interval and to execute at a contant
-- priority level (a part when subject to the immediate priority ceiling
-- protocol). The suspension/release mechanism is managed by a protected
-- object. In the worst case, the task behaviour is identical to the behaviour
-- of a cyclic task (GNAT.Ravenscar.Simple_Cyclic_Task) with Period =
-- Minimum_Interelease_Time.
--
-- The task timing behaviour can be analyzed with the most common timing
-- analysis techniques.
--
-- A typical example of usage is the following:
--
-- procedure Sporadic_Operation;
-- package My_Sporadic_Task is new GNATCOLL.Ravenscar.Simple_Sporadic_Task
-- (Task_Priority => 10,
-- Minimum_Interelease_Time => 1_000,
-- Protocol_Ceiling => 15,
-- System_Start_Time => System_Properties.Start_UP_Time,
-- Sporadic_Operation => Sporadic_Operation);
--
-- [...]
-- -- Release the task --
-- My_Sporadic_Task.Release;
-- [...]
--
-- The instantiation generates a sporadic task which executes at priority 10,
-- is ready to executed starting from System_UP_Time + Phase, executes
-- Sporadic_Operation, and enforce a minimum interelease time of 1000
-- milliseconds. Protocol_Ceiling is the ceiling priority of the protected
-- object managing the suspension/release mechanism of the task: the protected
-- object is accessed by both the clients (via Release) and the sporadic task
-- itself. Protocol_Ceiling must be equal to the priority of the client with
-- the highest priority, including the task itself (Task_Priority).
with Ada.Real_Time;
with System;
generic
Task_Priority : System.Priority;
-- The priority of the task
Minimum_Interelease_Time : Millisecond;
-- The minimum time between two consecutive releases
System_Start_Time : Ada.Real_Time.Time := Ada.Real_Time.Clock;
-- the system-wide relase time
Protocol_Ceiling : System.Any_Priority;
-- the ceiling priority of the protected object used to post and fetch
-- requests
with procedure Sporadic_Operation;
-- the nominal operation
package GNATCOLL.Ravenscar.Simple_Sporadic_Task is
procedure Release;
-- used by client to trigger the task
private
protected Protocol is
pragma Priority (Protocol_Ceiling);
procedure Release;
entry Wait (Release_Time : out Ada.Real_Time.Time);
private
Barrier : Boolean := False;
Pending : Integer := 0;
end Protocol;
task Simple_Sporadic_Task is
pragma Priority (Task_Priority);
end Simple_Sporadic_Task;
end GNATCOLL.Ravenscar.Simple_Sporadic_Task;
|