aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/s-taprop-linux.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2012-03-07 18:05:06 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2012-03-07 18:05:06 +0100
commitbde73c6b2681d054b70e5578af87ed55be3492a4 (patch)
treee9906110a74bfb490e965fdd3792fb80d5604268 /gcc/ada/s-taprop-linux.adb
parentb0d623bb216914a90b626439f4c96fba683bab2c (diff)
downloadgcc-bde73c6b2681d054b70e5578af87ed55be3492a4.zip
gcc-bde73c6b2681d054b70e5578af87ed55be3492a4.tar.gz
gcc-bde73c6b2681d054b70e5578af87ed55be3492a4.tar.bz2
[multiple changes]
2012-03-07 Robert Dewar <dewar@adacore.com> * sem_util.adb, exp_ch4.adb, exp_ch6.adb, sem_ch6.adb: Minor reformatting. 2012-03-07 Sergey Rybin <rybin@adacore.com frybin> * gnat_ugn.texi: gnatpp: fix paragraph about sources with preprocessor directives. 2012-03-07 Arnaud Charlet <charlet@adacore.com> * s-osinte-linux.ads, s-taprop-linux.adb (prctl): New function. (Enter_Task): Call prctl when relevant. 2012-03-07 Tristan Gingold <gingold@adacore.com> * s-osinte-vms.ads: pthread_mutex_setname_np: new function. From-SVN: r185065
Diffstat (limited to 'gcc/ada/s-taprop-linux.adb')
-rw-r--r--gcc/ada/s-taprop-linux.adb18
1 files changed, 17 insertions, 1 deletions
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