]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/pthread_setname_np.3
err.3: EXAMPLES: use EXIT_FAILURE rather than 1 as exit status
[thirdparty/man-pages.git] / man3 / pthread_setname_np.3
index 9170fb1c6fc65c9d38fc9a6f143451af1909be6a..790d040eab450a66cc73429e7a36174e35526259 100644 (file)
@@ -23,7 +23,7 @@
 .\" the source, must acknowledge the copyright and authors of this work.
 .\" %%%LICENSE_END
 .\"
-.TH PTHREAD_SETNAME_NP 3 2015-07-23 "Linux" "Linux Programmer's Manual"
+.TH PTHREAD_SETNAME_NP 3 2019-03-06 "Linux" "Linux Programmer's Manual"
 .SH NAME
 pthread_setname_np, pthread_getname_np \- set/get the name of a thread
 .SH SYNOPSIS
@@ -46,13 +46,13 @@ function can be used to set a unique name for a thread,
 which can be useful for debugging
 multithreaded applications.
 The thread name is a meaningful C language string, whose length is
-restricted to 16 characters, including the terminating null byte (\(aq\\0\(aq).
+restricted to 16 characters, including the terminating null byte (\(aq\e0\(aq).
 The
 .I thread
 argument specifies the thread whose name is to be changed;
 .I name
 specifies the new name.
-
+.PP
 The
 .BR pthread_getname_np ()
 function can be used to retrieve the name of the thread.
@@ -112,9 +112,10 @@ T{
 .BR pthread_getname_np ()
 T}     Thread safety   MT-Safe
 .TE
-
+.sp 1
 .SH CONFORMING TO
-These functions are nonstandard GNU extensions.
+These functions are nonstandard GNU extensions;
+hence the suffix "_np" (nonportable) in the names.
 .SH NOTES
 .BR pthread_setname_np ()
 internally writes to the thread-specific
@@ -125,17 +126,17 @@ filesystem:
 .IR /proc/self/task/[tid]/comm .
 .BR pthread_getname_np ()
 retrieves it from the same location.
-.SH EXAMPLE
+.SH EXAMPLES
 .PP
 The program below demonstrates the use of
 .BR pthread_setname_np ()
 and
 .BR pthread_getname_np ().
-
+.PP
 The following shell session shows a sample run of the program:
+.PP
 .in +4n
-.nf
-
+.EX
 .RB "$" " ./a.out"
 Created a thread. Default name is: a.out
 The thread name after setting it is THREADFOO.
@@ -149,11 +150,11 @@ The thread name after setting it is THREADFOO.
 a.out
 .RB "$ " "cat /proc/5990/task/5991/comm"
 THREADFOO
-.fi
+.EE
 .in
 .SS Program source
 \&
-.nf
+.EX
 #define _GNU_SOURCE
 #include <pthread.h>
 #include <stdio.h>
@@ -164,8 +165,8 @@ THREADFOO
 
 #define NAMELEN 16
 
-#define errExitEN(en, msg) \\
-            do { errno = en; perror(msg); exit(EXIT_FAILURE); \\
+#define errExitEN(en, msg) \e
+            do { errno = en; perror(msg); exit(EXIT_FAILURE); \e
         } while (0)
 
 static void *
@@ -190,7 +191,7 @@ main(int argc, char **argv)
     if (rc != 0)
         errExitEN(rc, "pthread_getname_np");
 
-    printf("Created a thread. Default name is: %s\\n", thread_name);
+    printf("Created a thread. Default name is: %s\en", thread_name);
     rc = pthread_setname_np(thread, (argc > 1) ? argv[1] : "THREADFOO");
     if (rc != 0)
         errExitEN(rc, "pthread_setname_np");
@@ -201,16 +202,16 @@ main(int argc, char **argv)
                             (argc > 2) ? atoi(argv[1]) : NAMELEN);
     if (rc != 0)
         errExitEN(rc, "pthread_getname_np");
-    printf("The thread name after setting it is %s.\\n", thread_name);
+    printf("The thread name after setting it is %s.\en", thread_name);
 
     rc = pthread_join(thread, NULL);
     if (rc != 0)
         errExitEN(rc, "pthread_join");
 
-    printf("Done\\n");
+    printf("Done\en");
     exit(EXIT_SUCCESS);
 }
-.fi
+.EE
 .SH SEE ALSO
 .ad l
 .nh