* s-taprop-vms.adb (Create_Task): set thread name.
* s-osinte-vms.ads (pthread_attr_setname_np): Declare.
2012-03-07 Arnaud Charlet <charlet@adacore.com>
* g-trasym.adb: Minor reformatting.
2012-03-07 Robert Dewar <dewar@adacore.com>
* a-ngrear.ads: Minor addition of ??? comment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185052
138bc75d-0d04-0410-961f-
82ee72b054a4
+2012-03-07 Tristan Gingold <gingold@adacore.com>
+
+ * s-taprop-vms.adb (Create_Task): set thread name.
+ * s-osinte-vms.ads (pthread_attr_setname_np): Declare.
+
+2012-03-07 Arnaud Charlet <charlet@adacore.com>
+
+ * g-trasym.adb: Minor reformatting.
+
+2012-03-07 Robert Dewar <dewar@adacore.com>
+
+ * a-ngrear.ads: Minor addition of ??? comment.
+
2012-03-07 Gary Dismukes <dismukes@adacore.com>
* exp_ch4.adb (Apply_Accessibility_Check): Call
-- front end always inline these, the expense of the unconstrained returns
-- can be avoided.
+ -- Confusing comment above, why does the front end always inline
+ -- these functions ???
+
pragma Inline ("+");
pragma Inline ("-");
pragma Inline ("*");
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2011, AdaCore --
+-- Copyright (C) 1999-2012, 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- --
-- Symbolic_Traceback --
------------------------
- function Symbolic_Traceback (Traceback : Tracebacks_Array) return String
- is
+ function Symbolic_Traceback (Traceback : Tracebacks_Array) return String is
begin
if Traceback'Length = 0 then
return "";
-
else
declare
Img : String := System.Address_Image (Traceback (Traceback'First));
end if;
end Symbolic_Traceback;
- function Symbolic_Traceback (E : Exception_Occurrence) return String
- is
+ function Symbolic_Traceback (E : Exception_Occurrence) return String is
begin
return Symbolic_Traceback (Tracebacks (E));
end Symbolic_Traceback;
sched_param : int) return int;
pragma Import (C, pthread_attr_setschedparam, "PTHREAD_ATTR_SETSCHEDPARAM");
+ function pthread_attr_setname_np
+ (attr : access pthread_attr_t;
+ name : System.Address;
+ mbz : System.Address) return int;
+ pragma Import (C, pthread_attr_setname_np, "PTHREAD_ATTR_SETNAME_NP");
+
function sched_yield return int;
--------------------------
function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Aux_DEC.Short_Address, Thread_Body);
+ Task_Name : String (1 .. System.Parameters.Max_Task_Image_Length + 1);
begin
-- Since the initial signal mask of a thread is inherited from the
-- creator, we need to set our local signal mask to mask all signals
(Attributes'Access, PTHREAD_EXPLICIT_SCHED);
pragma Assert (Result = 0);
+ if T.Common.Task_Image_Len > 0 then
+ -- Set thread name to ease debugging
+
+ Task_Name (1 .. T.Common.Task_Image_Len) :=
+ T.Common.Task_Image (1 .. T.Common.Task_Image_Len);
+ Task_Name (T.Common.Task_Image_Len + 1) := ASCII.NUL;
+
+ Result := pthread_attr_setname_np
+ (Attributes'Access, Task_Name'Address, Null_Address);
+ pragma Assert (Result = 0);
+ end if;
+
-- Note: the use of Unrestricted_Access in the following call is needed
-- because otherwise we have an error of getting a access-to-volatile
-- value which points to a non-volatile object. But in this case it is