1------------------------------------------------------------------------------
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-2021, 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
32with System.Tasking.Protected_Objects.Entries;
33
34package 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   --  Raise Program_Error in all tasks calling the protected entries of Object
43   --  The exception will not be raised immediately for the calling task; it
44   --  will be deferred until it calls Check_Exception.
45
46   procedure Enqueue (E : in out Entry_Queue; Call : Entry_Call_Link);
47   --  Enqueue Call at the end of entry_queue E
48
49   procedure Dequeue (E : in out Entry_Queue; Call : Entry_Call_Link);
50   --  Dequeue Call from entry_queue E
51
52   function Head (E : Entry_Queue) return Entry_Call_Link;
53   pragma Inline (Head);
54   --  Return the head of entry_queue E
55
56   procedure Dequeue_Head
57     (E    : in out Entry_Queue;
58      Call : out Entry_Call_Link);
59   --  Remove and return the head of entry_queue E
60
61   function Onqueue (Call : Entry_Call_Link) return Boolean;
62   pragma Inline (Onqueue);
63   --  Return True if Call is on any entry_queue at all
64
65   function Count_Waiting (E : Entry_Queue) return Natural;
66   --  Return number of calls on the waiting queue of E
67
68   procedure Select_Task_Entry_Call
69     (Acceptor         : Task_Id;
70      Open_Accepts     : Accept_List_Access;
71      Call             : out Entry_Call_Link;
72      Selection        : out Select_Index;
73      Open_Alternative : out Boolean);
74   --  Select an entry for rendezvous.  On exit:
75   --    Call will contain a pointer to the entry call record selected;
76   --    Selection will contain the index of the alternative selected
77   --    Open_Alternative will be True if there were any open alternatives
78
79   procedure Select_Protected_Entry_Call
80     (Self_ID : Task_Id;
81      Object  : POE.Protection_Entries_Access;
82      Call    : out Entry_Call_Link);
83   --  Select an entry of a protected object
84
85   procedure Enqueue_Call (Entry_Call : Entry_Call_Link);
86   procedure Dequeue_Call (Entry_Call : Entry_Call_Link);
87   --  Enqueue (dequeue) the call to (from) whatever server they are
88   --  calling, whether a task or a protected object.
89
90   procedure Requeue_Call_With_New_Prio
91     (Entry_Call : Entry_Call_Link; Prio : System.Any_Priority);
92   --  Change Priority of the call and re insert to the queue when priority
93   --  queueing is in effect. When FIFO is enforced, this routine
94   --  should not have any effect.
95
96end System.Tasking.Queuing;
97