From bde73c6b2681d054b70e5578af87ed55be3492a4 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 7 Mar 2012 18:05:06 +0100 Subject: [multiple changes] 2012-03-07 Robert Dewar * sem_util.adb, exp_ch4.adb, exp_ch6.adb, sem_ch6.adb: Minor reformatting. 2012-03-07 Sergey Rybin * gnat_ugn.texi: gnatpp: fix paragraph about sources with preprocessor directives. 2012-03-07 Arnaud Charlet * s-osinte-linux.ads, s-taprop-linux.adb (prctl): New function. (Enter_Task): Call prctl when relevant. 2012-03-07 Tristan Gingold * s-osinte-vms.ads: pthread_mutex_setname_np: new function. From-SVN: r185065 --- gcc/ada/s-taprop-linux.adb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'gcc/ada/s-taprop-linux.adb') diff --git a/gcc/ada/s-taprop-linux.adb b/gcc/ada/s-taprop-linux.adb index 4e69ea4..cf71082 100644 --- a/gcc/ada/s-taprop-linux.adb +++ b/gcc/ada/s-taprop-linux.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNARL 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- -- @@ -767,6 +767,22 @@ package body System.Task_Primitives.Operations is Self_ID.Common.LL.Thread := pthread_self; Self_ID.Common.LL.LWP := lwp_self; + if Self_ID.Common.Task_Image_Len > 0 then + declare + Task_Name : String (1 .. Parameters.Max_Task_Image_Length + 1); + Result : int; + begin + -- Set thread name to ease debugging + + Task_Name (1 .. Self_ID.Common.Task_Image_Len) := + Self_ID.Common.Task_Image (1 .. Self_ID.Common.Task_Image_Len); + Task_Name (Self_ID.Common.Task_Image_Len + 1) := ASCII.NUL; + + Result := prctl (PR_SET_NAME, unsigned_long (Task_Name'Address)); + pragma Assert (Result = 0); + end; + end if; + Specific.Set (Self_ID); if Use_Alternate_Stack -- cgit v1.1