]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/pthread_create.3
All pages: Replace the 4th argument to .TH by "Linux man-pages (unreleased)"
[thirdparty/man-pages.git] / man3 / pthread_create.3
index 3a86e3b1a5f0736ba1657fcdbc1f813dfe3a256b..8a894b329a2a0843d3cea16cdcc199d7c5e89f42 100644 (file)
@@ -1,47 +1,30 @@
 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
 .\"     <mtk.manpages@gmail.com>
 .\"
-.\" %%%LICENSE_START(VERBATIM)
-.\" Permission is granted to make and distribute verbatim copies of this
-.\" manual provided the copyright notice and this permission notice are
-.\" preserved on all copies.
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
 .\"
-.\" Permission is granted to copy and distribute modified versions of this
-.\" manual under the conditions for verbatim copying, provided that the
-.\" entire resulting derived work is distributed under the terms of a
-.\" permission notice identical to this one.
-.\"
-.\" Since the Linux kernel and libraries are constantly changing, this
-.\" manual page may be incorrect or out-of-date.  The author(s) assume no
-.\" responsibility for errors or omissions, or for damages resulting from
-.\" the use of the information contained herein.  The author(s) may not
-.\" have taken the same level of care in the production of this manual,
-.\" which is licensed free of charge, as they might when working
-.\" professionally.
-.\"
-.\" Formatted or processed versions of this manual, if unaccompanied by
-.\" the source, must acknowledge the copyright and authors of this work.
-.\" %%%LICENSE_END
-.\"
-.TH PTHREAD_CREATE 3 2020-11-01 "Linux" "Linux Programmer's Manual"
+.TH PTHREAD_CREATE 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
 .SH NAME
 pthread_create \- create a new thread
+.SH LIBRARY
+POSIX threads library
+.RI ( libpthread ", " \-lpthread )
 .SH SYNOPSIS
 .nf
 .B #include <pthread.h>
 .PP
-.BI "int pthread_create(pthread_t *" thread ", const pthread_attr_t *" attr ,
-.BI "                   void *(*" start_routine ")(void *), void *" arg );
+.BI "int pthread_create(pthread_t *restrict " thread ,
+.BI "                   const pthread_attr_t *restrict " attr ,
+.BI "                   void *(*" start_routine ")(void *),"
+.BI "                   void *restrict " arg );
 .fi
-.PP
-Compile and link with \fI\-pthread\fP.
 .SH DESCRIPTION
 The
 .BR pthread_create ()
 function starts a new thread in the calling process.
 The new thread starts execution by invoking
 .IR start_routine ();
-.IR arg
+.I arg
 is passed as the sole argument of
 .IR start_routine ().
 .PP
@@ -117,7 +100,7 @@ On success,
 .BR pthread_create ()
 returns 0;
 on error, it returns an error number, and the contents of
-.IR *thread
+.I *thread
 are undefined.
 .SH ERRORS
 .TP
@@ -128,13 +111,13 @@ Insufficient resources to create another thread.
 .\" NOTE! The following should match the description in fork(2)
 A system-imposed limit on the number of threads was encountered.
 There are a number of limits that may trigger this error: the
-.BR RLIMIT_NPROC
+.B RLIMIT_NPROC
 soft resource limit (set via
 .BR setrlimit (2)),
 which limits the number of processes and threads for a real user ID,
 was reached;
 the kernel's system-wide limit on the number of processes and threads,
-.IR /proc/sys/kernel/threads-max ,
+.IR /proc/sys/kernel/threads\-max ,
 was reached (see
 .BR proc (5));
 or the maximum number of PIDs,
@@ -153,23 +136,27 @@ No permission to set the scheduling policy and parameters specified in
 .SH ATTRIBUTES
 For an explanation of the terms used in this section, see
 .BR attributes (7).
+.ad l
+.nh
 .TS
 allbox;
-lb lb lb
+lbx lb lb
 l l l.
 Interface      Attribute       Value
 T{
 .BR pthread_create ()
 T}     Thread safety   MT-Safe
 .TE
+.hy
+.ad
 .sp 1
-.SH CONFORMING TO
+.SH STANDARDS
 POSIX.1-2001, POSIX.1-2008.
 .SH NOTES
 See
 .BR pthread_self (3)
 for further information on the thread ID returned in
-.IR *thread
+.I *thread
 by
 .BR pthread_create ().
 Unless real-time scheduling policies are being employed,
@@ -199,9 +186,9 @@ was set to create the thread in a detached state (using
 .BR pthread_attr_setdetachstate (3)).
 .PP
 Under the NPTL threading implementation, if the
-.BR RLIMIT_STACK
+.B RLIMIT_STACK
 soft resource limit
-.IR "at the time the program started"
+.I at the time the program started
 has any value other than "unlimited",
 then it determines the default stack size of new threads.
 Using
@@ -211,7 +198,7 @@ the stack size attribute can be explicitly set in the
 argument used to create a thread,
 in order to obtain a stack size other than the default.
 If the
-.BR RLIMIT_STACK
+.B RLIMIT_STACK
 resource limit is set to "unlimited",
 a per-architecture value is used for the stack size.
 Here is the value for a few architectures:
@@ -308,7 +295,7 @@ thread_start(void *arg)
     char *uargv;
 
     printf("Thread %d: top of stack near %p; argv_string=%s\en",
-            tinfo\->thread_num, &p, tinfo\->argv_string);
+            tinfo\->thread_num, (void *) &tinfo, tinfo\->argv_string);
 
     uargv = strdup(tinfo\->argv_string);
     if (uargv == NULL)
@@ -325,7 +312,7 @@ main(int argc, char *argv[])
 {
     int s, opt, num_threads;
     pthread_attr_t attr;
-    size_t stack_size;
+    ssize_t stack_size;
     void *res;
 
     /* The "\-s" option specifies a stack size for our threads. */
@@ -338,7 +325,7 @@ main(int argc, char *argv[])
             break;
 
         default:
-            fprintf(stderr, "Usage: %s [\-s stack-size] arg...\en",
+            fprintf(stderr, "Usage: %s [\-s stack\-size] arg...\en",
                     argv[0]);
             exit(EXIT_FAILURE);
         }