1 |
706 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- S Y S T E M . T A S K I N G . Q U E U I N G --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
|
10 |
|
|
-- --
|
11 |
|
|
-- GNARL is free software; you can redistribute it and/or modify it under --
|
12 |
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
13 |
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
14 |
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
15 |
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
16 |
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
17 |
|
|
-- --
|
18 |
|
|
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
19 |
|
|
-- additional permissions described in the GCC Runtime Library Exception, --
|
20 |
|
|
-- version 3.1, as published by the Free Software Foundation. --
|
21 |
|
|
-- --
|
22 |
|
|
-- You should have received a copy of the GNU General Public License and --
|
23 |
|
|
-- a copy of the GCC Runtime Library Exception along with this program; --
|
24 |
|
|
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
25 |
|
|
-- <http://www.gnu.org/licenses/>. --
|
26 |
|
|
-- --
|
27 |
|
|
-- GNARL was developed by the GNARL team at Florida State University. --
|
28 |
|
|
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
|
29 |
|
|
-- --
|
30 |
|
|
------------------------------------------------------------------------------
|
31 |
|
|
|
32 |
|
|
with System.Tasking.Protected_Objects.Entries;
|
33 |
|
|
|
34 |
|
|
package System.Tasking.Queuing is
|
35 |
|
|
|
36 |
|
|
package POE renames System.Tasking.Protected_Objects.Entries;
|
37 |
|
|
|
38 |
|
|
procedure Broadcast_Program_Error
|
39 |
|
|
(Self_ID : Task_Id;
|
40 |
|
|
Object : POE.Protection_Entries_Access;
|
41 |
|
|
Pending_Call : Entry_Call_Link;
|
42 |
|
|
RTS_Locked : Boolean := False);
|
43 |
|
|
-- Raise Program_Error in all tasks calling the protected entries of Object
|
44 |
|
|
-- The exception will not be raised immediately for the calling task; it
|
45 |
|
|
-- will be deferred until it calls Check_Exception.
|
46 |
|
|
-- RTS_Locked indicates whether the global RTS lock is taken (only
|
47 |
|
|
-- relevant if Single_Lock is True).
|
48 |
|
|
|
49 |
|
|
procedure Enqueue (E : in out Entry_Queue; Call : Entry_Call_Link);
|
50 |
|
|
-- Enqueue Call at the end of entry_queue E
|
51 |
|
|
|
52 |
|
|
procedure Dequeue (E : in out Entry_Queue; Call : Entry_Call_Link);
|
53 |
|
|
-- Dequeue Call from entry_queue E
|
54 |
|
|
|
55 |
|
|
function Head (E : Entry_Queue) return Entry_Call_Link;
|
56 |
|
|
pragma Inline (Head);
|
57 |
|
|
-- Return the head of entry_queue E
|
58 |
|
|
|
59 |
|
|
procedure Dequeue_Head
|
60 |
|
|
(E : in out Entry_Queue;
|
61 |
|
|
Call : out Entry_Call_Link);
|
62 |
|
|
-- Remove and return the head of entry_queue E
|
63 |
|
|
|
64 |
|
|
function Onqueue (Call : Entry_Call_Link) return Boolean;
|
65 |
|
|
pragma Inline (Onqueue);
|
66 |
|
|
-- Return True if Call is on any entry_queue at all
|
67 |
|
|
|
68 |
|
|
function Count_Waiting (E : Entry_Queue) return Natural;
|
69 |
|
|
-- Return number of calls on the waiting queue of E
|
70 |
|
|
|
71 |
|
|
procedure Select_Task_Entry_Call
|
72 |
|
|
(Acceptor : Task_Id;
|
73 |
|
|
Open_Accepts : Accept_List_Access;
|
74 |
|
|
Call : out Entry_Call_Link;
|
75 |
|
|
Selection : out Select_Index;
|
76 |
|
|
Open_Alternative : out Boolean);
|
77 |
|
|
-- Select an entry for rendezvous. On exit:
|
78 |
|
|
-- Call will contain a pointer to the entry call record selected;
|
79 |
|
|
-- Selection will contain the index of the alternative selected
|
80 |
|
|
-- Open_Alternative will be True if there were any open alternatives
|
81 |
|
|
|
82 |
|
|
procedure Select_Protected_Entry_Call
|
83 |
|
|
(Self_ID : Task_Id;
|
84 |
|
|
Object : POE.Protection_Entries_Access;
|
85 |
|
|
Call : out Entry_Call_Link);
|
86 |
|
|
-- Select an entry of a protected object
|
87 |
|
|
|
88 |
|
|
procedure Enqueue_Call (Entry_Call : Entry_Call_Link);
|
89 |
|
|
procedure Dequeue_Call (Entry_Call : Entry_Call_Link);
|
90 |
|
|
-- Enqueue (dequeue) the call to (from) whatever server they are
|
91 |
|
|
-- calling, whether a task or a protected object.
|
92 |
|
|
|
93 |
|
|
procedure Requeue_Call_With_New_Prio
|
94 |
|
|
(Entry_Call : Entry_Call_Link; Prio : System.Any_Priority);
|
95 |
|
|
-- Change Priority of the call and re insert to the queue when priority
|
96 |
|
|
-- queueing is in effect. When FIFO is enforced, this routine
|
97 |
|
|
-- should not have any effect.
|
98 |
|
|
|
99 |
|
|
end System.Tasking.Queuing;
|