1 ------------------------------------------------------------------------------
3 -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
5 -- S Y S T E M . T A S K _ P R I M I T I V E S . O P E R A T I O N S --
9 -- Copyright (C) 1992-2003, Free Software Foundation, Inc. --
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 2, or (at your option) any later ver- --
14 -- sion. GNARL 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNARL; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
29 -- GNARL was developed by the GNARL team at Florida State University. --
30 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
32 ------------------------------------------------------------------------------
34 -- This is a GNU/Linux (GNU/LinuxThreads) version of this package
36 -- This package contains all the GNULL primitives that interface directly
37 -- with the underlying OS.
40 -- Turn off polling, we do not want ATC polling to take place during
41 -- tasking operations. It causes infinite loops and other problems.
43 with System.Tasking.Debug;
44 -- used for Known_Tasks
50 with System.Interrupt_Management;
51 -- used for Keep_Unmasked
52 -- Abort_Task_Interrupt
55 with System.Interrupt_Management.Operations;
56 -- used for Set_Interrupt_Mask
58 pragma Elaborate_All (System.Interrupt_Management.Operations);
60 with System.Parameters;
64 -- used for Ada_Task_Control_Block
68 -- used for Raise_Exception
69 -- Raise_From_Signal_Handler
72 with System.Soft_Links;
73 -- used for Defer/Undefer_Abort
75 -- Note that we do not use System.Tasking.Initialization directly since
76 -- this is a higher level package that we shouldn't depend on. For example
77 -- when using the restricted run time, it is replaced by
78 -- System.Tasking.Restricted.Initialization
80 with System.OS_Primitives;
81 -- used for Delay_Modes
83 with System.Soft_Links;
84 -- used for Get_Machine_State_Addr
86 with Unchecked_Conversion;
87 with Unchecked_Deallocation;
89 package body System.Task_Primitives.Operations is
91 use System.Tasking.Debug;
94 use System.OS_Interface;
95 use System.Parameters;
96 use System.OS_Primitives;
98 package SSL renames System.Soft_Links;
104 -- The followings are logically constants, but need to be initialized
107 Single_RTS_Lock : aliased RTS_Lock;
108 -- This is a lock to allow only one thread of control in the RTS at
109 -- a time; it is used to execute in mutual exclusion from all other tasks.
110 -- Used mainly in Single_Lock mode, but also to protect All_Tasks_List
112 ATCB_Key : aliased pthread_key_t;
113 -- Key used to find the Ada Task_ID associated with a thread
115 Environment_Task_ID : Task_ID;
116 -- A variable to hold Task_ID for the environment task.
118 Unblocked_Signal_Mask : aliased sigset_t;
119 -- The set of signals that should unblocked in all tasks
121 -- The followings are internal configuration constants needed.
122 Priority_Ceiling_Emulation : constant Boolean := True;
124 Next_Serial_Number : Task_Serial_Number := 100;
125 -- We start at 100, to reserve some special values for
126 -- using in error checking.
127 -- The following are internal configuration constants needed.
129 Time_Slice_Val : Integer;
130 pragma Import (C, Time_Slice_Val, "__gl_time_slice_val");
132 Dispatching_Policy : Character;
133 pragma Import (C, Dispatching_Policy, "__gl_task_dispatching_policy");
135 FIFO_Within_Priorities : constant Boolean := Dispatching_Policy = 'F';
136 -- Indicates whether FIFO_Within_Priorities is set.
138 -- The following are effectively constants, but they need to
139 -- be initialized by calling a pthread_ function.
141 Mutex_Attr : aliased pthread_mutexattr_t;
142 Cond_Attr : aliased pthread_condattr_t;
144 Foreign_Task_Elaborated : aliased Boolean := True;
145 -- Used to identified fake tasks (i.e., non-Ada Threads).
153 procedure Initialize (Environment_Task : Task_ID);
154 pragma Inline (Initialize);
155 -- Initialize various data needed by this package.
157 function Is_Valid_Task return Boolean;
158 pragma Inline (Is_Valid_Task);
159 -- Does executing thread have a TCB?
161 procedure Set (Self_Id : Task_ID);
163 -- Set the self id for the current task.
165 function Self return Task_ID;
166 pragma Inline (Self);
167 -- Return a pointer to the Ada Task Control Block of the calling task.
171 package body Specific is separate;
172 -- The body of this package is target specific.
174 ---------------------------------
175 -- Support for foreign threads --
176 ---------------------------------
178 function Register_Foreign_Thread (Thread : Thread_Id) return Task_ID;
179 -- Allocate and Initialize a new ATCB for the current Thread.
181 function Register_Foreign_Thread
182 (Thread : Thread_Id) return Task_ID is separate;
184 -----------------------
185 -- Local Subprograms --
186 -----------------------
188 subtype unsigned_long is Interfaces.C.unsigned_long;
190 procedure Abort_Handler (signo : Signal);
192 function To_Address is new Unchecked_Conversion (Task_ID, System.Address);
194 function To_pthread_t is new Unchecked_Conversion
195 (unsigned_long, System.OS_Interface.pthread_t);
201 procedure Abort_Handler (signo : Signal) is
202 pragma Unreferenced (signo);
204 Self_Id : Task_ID := Self;
205 Result : Interfaces.C.int;
206 Old_Set : aliased sigset_t;
209 if ZCX_By_Default and then GCC_ZCX_Support then
213 if Self_Id.Deferral_Level = 0
214 and then Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level
215 and then not Self_Id.Aborting
217 Self_Id.Aborting := True;
219 -- Make sure signals used for RTS internal purpose are unmasked
221 Result := pthread_sigmask (SIG_UNBLOCK,
222 Unblocked_Signal_Mask'Unchecked_Access, Old_Set'Unchecked_Access);
223 pragma Assert (Result = 0);
225 raise Standard'Abort_Signal;
233 procedure Lock_RTS is
235 Write_Lock (Single_RTS_Lock'Access, Global_Lock => True);
242 procedure Unlock_RTS is
244 Unlock (Single_RTS_Lock'Access, Global_Lock => True);
251 -- The underlying thread system extends the memory (up to 2MB) when needed
253 procedure Stack_Guard (T : ST.Task_ID; On : Boolean) is
254 pragma Unreferenced (T);
255 pragma Unreferenced (On);
265 function Get_Thread_Id (T : ST.Task_ID) return OSI.Thread_Id is
267 return T.Common.LL.Thread;
274 function Self return Task_ID renames Specific.Self;
276 ---------------------
277 -- Initialize_Lock --
278 ---------------------
280 -- Note: mutexes and cond_variables needed per-task basis are
281 -- initialized in Initialize_TCB and the Storage_Error is
282 -- handled. Other mutexes (such as RTS_Lock, Memory_Lock...)
283 -- used in RTS is initialized before any status change of RTS.
284 -- Therefore rasing Storage_Error in the following routines
285 -- should be able to be handled safely.
287 procedure Initialize_Lock
288 (Prio : System.Any_Priority;
291 Result : Interfaces.C.int;
294 if Priority_Ceiling_Emulation then
298 Result := pthread_mutex_init (L.L'Access, Mutex_Attr'Access);
300 pragma Assert (Result = 0 or else Result = ENOMEM);
302 if Result = ENOMEM then
303 Ada.Exceptions.Raise_Exception (Storage_Error'Identity,
304 "Failed to allocate a lock");
308 procedure Initialize_Lock (L : access RTS_Lock; Level : Lock_Level) is
309 pragma Unreferenced (Level);
311 Result : Interfaces.C.int;
314 Result := pthread_mutex_init (L, Mutex_Attr'Access);
316 pragma Assert (Result = 0 or else Result = ENOMEM);
318 if Result = ENOMEM then
327 procedure Finalize_Lock (L : access Lock) is
328 Result : Interfaces.C.int;
331 Result := pthread_mutex_destroy (L.L'Access);
332 pragma Assert (Result = 0);
335 procedure Finalize_Lock (L : access RTS_Lock) is
336 Result : Interfaces.C.int;
339 Result := pthread_mutex_destroy (L);
340 pragma Assert (Result = 0);
347 procedure Write_Lock (L : access Lock; Ceiling_Violation : out Boolean) is
348 Result : Interfaces.C.int;
351 if Priority_Ceiling_Emulation then
353 Self_ID : constant Task_ID := Self;
356 if Self_ID.Common.LL.Active_Priority > L.Ceiling then
357 Ceiling_Violation := True;
361 L.Saved_Priority := Self_ID.Common.LL.Active_Priority;
363 if Self_ID.Common.LL.Active_Priority < L.Ceiling then
364 Self_ID.Common.LL.Active_Priority := L.Ceiling;
367 Result := pthread_mutex_lock (L.L'Access);
368 pragma Assert (Result = 0);
369 Ceiling_Violation := False;
373 Result := pthread_mutex_lock (L.L'Access);
374 Ceiling_Violation := Result = EINVAL;
376 -- Assume the cause of EINVAL is a priority ceiling violation
378 pragma Assert (Result = 0 or else Result = EINVAL);
383 (L : access RTS_Lock;
384 Global_Lock : Boolean := False)
386 Result : Interfaces.C.int;
389 if not Single_Lock or else Global_Lock then
390 Result := pthread_mutex_lock (L);
391 pragma Assert (Result = 0);
395 procedure Write_Lock (T : Task_ID) is
396 Result : Interfaces.C.int;
399 if not Single_Lock then
400 Result := pthread_mutex_lock (T.Common.LL.L'Access);
401 pragma Assert (Result = 0);
409 procedure Read_Lock (L : access Lock; Ceiling_Violation : out Boolean) is
411 Write_Lock (L, Ceiling_Violation);
418 procedure Unlock (L : access Lock) is
419 Result : Interfaces.C.int;
422 if Priority_Ceiling_Emulation then
424 Self_ID : constant Task_ID := Self;
427 Result := pthread_mutex_unlock (L.L'Access);
428 pragma Assert (Result = 0);
430 if Self_ID.Common.LL.Active_Priority > L.Saved_Priority then
431 Self_ID.Common.LL.Active_Priority := L.Saved_Priority;
436 Result := pthread_mutex_unlock (L.L'Access);
437 pragma Assert (Result = 0);
441 procedure Unlock (L : access RTS_Lock; Global_Lock : Boolean := False) is
442 Result : Interfaces.C.int;
445 if not Single_Lock or else Global_Lock then
446 Result := pthread_mutex_unlock (L);
447 pragma Assert (Result = 0);
451 procedure Unlock (T : Task_ID) is
452 Result : Interfaces.C.int;
455 if not Single_Lock then
456 Result := pthread_mutex_unlock (T.Common.LL.L'Access);
457 pragma Assert (Result = 0);
467 Reason : System.Tasking.Task_States)
469 pragma Unreferenced (Reason);
471 Result : Interfaces.C.int;
474 pragma Assert (Self_ID = Self);
477 Result := pthread_cond_wait
478 (Self_ID.Common.LL.CV'Access, Single_RTS_Lock'Access);
480 Result := pthread_cond_wait
481 (Self_ID.Common.LL.CV'Access, Self_ID.Common.LL.L'Access);
484 -- EINTR is not considered a failure.
485 pragma Assert (Result = 0 or else Result = EINTR);
492 -- This is for use within the run-time system, so abort is
493 -- assumed to be already deferred, and the caller should be
494 -- holding its own ATCB lock.
496 procedure Timed_Sleep
499 Mode : ST.Delay_Modes;
500 Reason : System.Tasking.Task_States;
501 Timedout : out Boolean;
502 Yielded : out Boolean)
504 pragma Unreferenced (Reason);
506 Check_Time : constant Duration := Monotonic_Clock;
508 Request : aliased timespec;
509 Result : Interfaces.C.int;
515 if Mode = Relative then
516 Abs_Time := Duration'Min (Time, Max_Sensible_Delay) + Check_Time;
518 Abs_Time := Duration'Min (Check_Time + Max_Sensible_Delay, Time);
521 if Abs_Time > Check_Time then
522 Request := To_Timespec (Abs_Time);
525 exit when Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level
526 or else Self_ID.Pending_Priority_Change;
529 Result := pthread_cond_timedwait
530 (Self_ID.Common.LL.CV'Access, Single_RTS_Lock'Access,
534 Result := pthread_cond_timedwait
535 (Self_ID.Common.LL.CV'Access, Self_ID.Common.LL.L'Access,
539 exit when Abs_Time <= Monotonic_Clock;
541 if Result = 0 or Result = EINTR then
542 -- somebody may have called Wakeup for us
547 pragma Assert (Result = ETIMEDOUT);
556 -- This is for use in implementing delay statements, so
557 -- we assume the caller is abort-deferred but is holding
560 procedure Timed_Delay
563 Mode : ST.Delay_Modes)
565 Check_Time : constant Duration := Monotonic_Clock;
567 Request : aliased timespec;
568 Result : Interfaces.C.int;
571 -- Only the little window between deferring abort and
572 -- locking Self_ID is the reason we need to
573 -- check for pending abort and priority change below! :(
581 Write_Lock (Self_ID);
583 if Mode = Relative then
584 Abs_Time := Time + Check_Time;
586 Abs_Time := Duration'Min (Check_Time + Max_Sensible_Delay, Time);
589 if Abs_Time > Check_Time then
590 Request := To_Timespec (Abs_Time);
591 Self_ID.Common.State := Delay_Sleep;
594 if Self_ID.Pending_Priority_Change then
595 Self_ID.Pending_Priority_Change := False;
596 Self_ID.Common.Base_Priority := Self_ID.New_Base_Priority;
597 Set_Priority (Self_ID, Self_ID.Common.Base_Priority);
600 exit when Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level;
603 Result := pthread_cond_timedwait (Self_ID.Common.LL.CV'Access,
604 Single_RTS_Lock'Access, Request'Access);
606 Result := pthread_cond_timedwait (Self_ID.Common.LL.CV'Access,
607 Self_ID.Common.LL.L'Access, Request'Access);
610 exit when Abs_Time <= Monotonic_Clock;
612 pragma Assert (Result = 0 or else
613 Result = ETIMEDOUT or else
617 Self_ID.Common.State := Runnable;
626 Result := sched_yield;
627 SSL.Abort_Undefer.all;
630 ---------------------
631 -- Monotonic_Clock --
632 ---------------------
634 function Monotonic_Clock return Duration is
635 TV : aliased struct_timeval;
636 Result : Interfaces.C.int;
639 Result := gettimeofday (TV'Access, System.Null_Address);
640 pragma Assert (Result = 0);
641 return To_Duration (TV);
648 function RT_Resolution return Duration is
657 procedure Wakeup (T : Task_ID; Reason : System.Tasking.Task_States) is
658 pragma Unreferenced (Reason);
660 Result : Interfaces.C.int;
663 Result := pthread_cond_signal (T.Common.LL.CV'Access);
664 pragma Assert (Result = 0);
671 procedure Yield (Do_Yield : Boolean := True) is
672 Result : Interfaces.C.int;
673 pragma Unreferenced (Result);
677 Result := sched_yield;
685 procedure Set_Priority
687 Prio : System.Any_Priority;
688 Loss_Of_Inheritance : Boolean := False)
690 pragma Unreferenced (Loss_Of_Inheritance);
692 Result : Interfaces.C.int;
693 Param : aliased struct_sched_param;
696 T.Common.Current_Priority := Prio;
698 if Priority_Ceiling_Emulation then
699 if T.Common.LL.Active_Priority < Prio then
700 T.Common.LL.Active_Priority := Prio;
704 -- Priorities are in range 1 .. 99 on GNU/Linux, so we map
705 -- map 0 .. 31 to 1 .. 32
707 Param.sched_priority := Interfaces.C.int (Prio) + 1;
709 if Time_Slice_Val > 0 then
710 Result := pthread_setschedparam
711 (T.Common.LL.Thread, SCHED_RR, Param'Access);
713 elsif FIFO_Within_Priorities or else Time_Slice_Val = 0 then
714 Result := pthread_setschedparam
715 (T.Common.LL.Thread, SCHED_FIFO, Param'Access);
718 Result := pthread_setschedparam
719 (T.Common.LL.Thread, SCHED_OTHER, Param'Access);
722 pragma Assert (Result = 0 or else Result = EPERM);
729 function Get_Priority (T : Task_ID) return System.Any_Priority is
731 return T.Common.Current_Priority;
738 procedure Enter_Task (Self_ID : Task_ID) is
740 Self_ID.Common.LL.Thread := pthread_self;
742 Specific.Set (Self_ID);
746 for J in Known_Tasks'Range loop
747 if Known_Tasks (J) = null then
748 Known_Tasks (J) := Self_ID;
749 Self_ID.Known_Tasks_Index := J;
761 function New_ATCB (Entry_Num : Task_Entry_Index) return Task_ID is
763 return new Ada_Task_Control_Block (Entry_Num);
770 function Is_Valid_Task return Boolean renames Specific.Is_Valid_Task;
772 -----------------------------
773 -- Register_Foreign_Thread --
774 -----------------------------
776 function Register_Foreign_Thread return Task_ID is
778 if Is_Valid_Task then
781 return Register_Foreign_Thread (pthread_self);
783 end Register_Foreign_Thread;
789 procedure Initialize_TCB (Self_ID : Task_ID; Succeeded : out Boolean) is
790 Result : Interfaces.C.int;
793 -- Give the task a unique serial number.
795 Self_ID.Serial_Number := Next_Serial_Number;
796 Next_Serial_Number := Next_Serial_Number + 1;
797 pragma Assert (Next_Serial_Number /= 0);
799 Self_ID.Common.LL.Thread := To_pthread_t (-1);
801 if not Single_Lock then
802 Result := pthread_mutex_init (Self_ID.Common.LL.L'Access,
804 pragma Assert (Result = 0 or else Result = ENOMEM);
812 Result := pthread_cond_init (Self_ID.Common.LL.CV'Access,
814 pragma Assert (Result = 0 or else Result = ENOMEM);
819 if not Single_Lock then
820 Result := pthread_mutex_destroy (Self_ID.Common.LL.L'Access);
821 pragma Assert (Result = 0);
832 procedure Create_Task
834 Wrapper : System.Address;
835 Stack_Size : System.Parameters.Size_Type;
836 Priority : System.Any_Priority;
837 Succeeded : out Boolean)
839 Adjusted_Stack_Size : Interfaces.C.size_t;
841 Attributes : aliased pthread_attr_t;
842 Result : Interfaces.C.int;
844 function Thread_Body_Access is new
845 Unchecked_Conversion (System.Address, Thread_Body);
848 if Stack_Size = Unspecified_Size then
849 Adjusted_Stack_Size := Interfaces.C.size_t (Default_Stack_Size);
851 elsif Stack_Size < Minimum_Stack_Size then
852 Adjusted_Stack_Size := Interfaces.C.size_t (Minimum_Stack_Size);
855 Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
858 Result := pthread_attr_init (Attributes'Access);
859 pragma Assert (Result = 0 or else Result = ENOMEM);
867 pthread_attr_setstacksize
868 (Attributes'Access, Adjusted_Stack_Size);
869 pragma Assert (Result = 0);
872 pthread_attr_setdetachstate
873 (Attributes'Access, PTHREAD_CREATE_DETACHED);
874 pragma Assert (Result = 0);
876 -- Since the initial signal mask of a thread is inherited from the
877 -- creator, and the Environment task has all its signals masked, we
878 -- do not need to manipulate caller's signal mask at this point.
879 -- All tasks in RTS will have All_Tasks_Mask initially.
881 Result := pthread_create
882 (T.Common.LL.Thread'Access,
884 Thread_Body_Access (Wrapper),
886 pragma Assert (Result = 0 or else Result = EAGAIN);
888 Succeeded := Result = 0;
890 Result := pthread_attr_destroy (Attributes'Access);
891 pragma Assert (Result = 0);
893 Set_Priority (T, Priority);
900 procedure Finalize_TCB (T : Task_ID) is
901 Result : Interfaces.C.int;
903 Is_Self : constant Boolean := T = Self;
905 procedure Free is new
906 Unchecked_Deallocation (Ada_Task_Control_Block, Task_ID);
909 if not Single_Lock then
910 Result := pthread_mutex_destroy (T.Common.LL.L'Access);
911 pragma Assert (Result = 0);
914 Result := pthread_cond_destroy (T.Common.LL.CV'Access);
915 pragma Assert (Result = 0);
917 if T.Known_Tasks_Index /= -1 then
918 Known_Tasks (T.Known_Tasks_Index) := null;
924 Result := pthread_setspecific (ATCB_Key, System.Null_Address);
925 pragma Assert (Result = 0);
934 procedure Exit_Task is
943 procedure Abort_Task (T : Task_ID) is
944 Result : Interfaces.C.int;
947 Result := pthread_kill (T.Common.LL.Thread,
948 Signal (System.Interrupt_Management.Abort_Task_Interrupt));
949 pragma Assert (Result = 0);
958 function Check_Exit (Self_ID : ST.Task_ID) return Boolean is
959 pragma Unreferenced (Self_ID);
969 function Check_No_Locks (Self_ID : ST.Task_ID) return Boolean is
970 pragma Unreferenced (Self_ID);
976 ----------------------
977 -- Environment_Task --
978 ----------------------
980 function Environment_Task return Task_ID is
982 return Environment_Task_ID;
983 end Environment_Task;
989 function Suspend_Task
991 Thread_Self : Thread_Id)
995 if T.Common.LL.Thread /= Thread_Self then
996 return pthread_kill (T.Common.LL.Thread, SIGSTOP) = 0;
1006 function Resume_Task
1008 Thread_Self : Thread_Id)
1012 if T.Common.LL.Thread /= Thread_Self then
1013 return pthread_kill (T.Common.LL.Thread, SIGCONT) = 0;
1023 procedure Initialize (Environment_Task : Task_ID) is
1024 act : aliased struct_sigaction;
1025 old_act : aliased struct_sigaction;
1026 Tmp_Set : aliased sigset_t;
1027 Result : Interfaces.C.int;
1029 function State (Int : System.Interrupt_Management.Interrupt_ID)
1031 pragma Import (C, State, "__gnat_get_interrupt_state");
1032 -- Get interrupt state. Defined in a-init.c
1033 -- The input argument is the interrupt number,
1034 -- and the result is one of the following:
1036 Default : constant Character := 's';
1037 -- 'n' this interrupt not set by any Interrupt_State pragma
1038 -- 'u' Interrupt_State pragma set state to User
1039 -- 'r' Interrupt_State pragma set state to Runtime
1040 -- 's' Interrupt_State pragma set state to System (use "default"
1044 Environment_Task_ID := Environment_Task;
1046 Result := pthread_mutexattr_init (Mutex_Attr'Access);
1047 pragma Assert (Result = 0 or else Result = ENOMEM);
1049 Result := pthread_condattr_init (Cond_Attr'Access);
1050 pragma Assert (Result = 0 or else Result = ENOMEM);
1052 Initialize_Lock (Single_RTS_Lock'Access, RTS_Lock_Level);
1054 -- Initialize the global RTS lock
1056 Specific.Initialize (Environment_Task);
1058 Enter_Task (Environment_Task);
1060 -- Install the abort-signal handler
1062 if State (System.Interrupt_Management.Abort_Task_Interrupt)
1066 act.sa_handler := Abort_Handler'Address;
1068 Result := sigemptyset (Tmp_Set'Access);
1069 pragma Assert (Result = 0);
1070 act.sa_mask := Tmp_Set;
1074 (Signal (Interrupt_Management.Abort_Task_Interrupt),
1075 act'Unchecked_Access,
1076 old_act'Unchecked_Access);
1077 pragma Assert (Result = 0);
1083 Result : Interfaces.C.int;
1086 -- Mask Environment task for all signals. The original mask of the
1087 -- Environment task will be recovered by Interrupt_Server task
1088 -- during the elaboration of s-interr.adb.
1090 System.Interrupt_Management.Operations.Set_Interrupt_Mask
1091 (System.Interrupt_Management.Operations.All_Tasks_Mask'Access);
1093 -- Prepare the set of signals that should unblocked in all tasks
1095 Result := sigemptyset (Unblocked_Signal_Mask'Access);
1096 pragma Assert (Result = 0);
1098 for J in Interrupt_Management.Interrupt_ID loop
1099 if System.Interrupt_Management.Keep_Unmasked (J) then
1100 Result := sigaddset (Unblocked_Signal_Mask'Access, Signal (J));
1101 pragma Assert (Result = 0);
1105 end System.Task_Primitives.Operations;