diff options
Diffstat (limited to 'man3/pthread_create.3')
-rw-r--r-- | man3/pthread_create.3 | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/man3/pthread_create.3 b/man3/pthread_create.3 index 66c67a6ff..1e0ccd84d 100644 --- a/man3/pthread_create.3 +++ b/man3/pthread_create.3 @@ -32,24 +32,24 @@ is passed as the sole argument of The new thread terminates in one of the following ways: .IP \[bu] 3 It calls -.BR pthread_exit (3), +.MR pthread_exit 3 , specifying an exit status value that is available to another thread in the same process that calls -.BR pthread_join (3). +.MR pthread_join 3 . .IP \[bu] It returns from .IR start_routine (). This is equivalent to calling -.BR pthread_exit (3) +.MR pthread_exit 3 with the value supplied in the .I return statement. .IP \[bu] It is canceled (see -.BR pthread_cancel (3)). +.MR pthread_cancel 3 ). .IP \[bu] Any of the threads in the process calls -.BR exit (3), +.MR exit 3 , or the main thread performs a return from .IR main (). This causes the termination of all threads in the process. @@ -61,7 +61,7 @@ argument points to a structure whose contents are used at thread creation time to determine attributes for the new thread; this structure is initialized using -.BR pthread_attr_init (3) +.MR pthread_attr_init 3 and related functions. If .I attr @@ -76,26 +76,30 @@ this identifier is used to refer to the thread in subsequent calls to other pthreads functions. .P The new thread inherits a copy of the creating thread's signal mask -.RB ( pthread_sigmask (3)). +\%(\c +.MR pthread_sigmask 3 ). The set of pending signals for the new thread is empty -.RB ( sigpending (2)). +\%(\c +.MR sigpending 2 ). The new thread does not inherit the creating thread's alternate signal stack -.RB ( sigaltstack (2)). +\%(\c +.MR sigaltstack 2 ). .P The new thread inherits the calling thread's floating-point environment -.RB ( fenv (3)). +\%(\c +.MR fenv 3 ). .P The initial value of the new thread's CPU-time clock is 0 (see -.BR pthread_getcpuclockid (3)). +.MR pthread_getcpuclockid 3 ). .\" CLOCK_THREAD_CPUTIME_ID in clock_gettime(2) .SS Linux-specific details The new thread inherits copies of the calling thread's capability sets (see -.BR capabilities (7)) +.MR capabilities 7 ) and CPU affinity mask (see -.BR sched_setaffinity (2)). +.MR sched_setaffinity 2 ). .SH RETURN VALUE On success, .BR pthread_create () @@ -114,17 +118,17 @@ A system-imposed limit on the number of threads was encountered. There are a number of limits that may trigger this error: the .B RLIMIT_NPROC soft resource limit (set via -.BR setrlimit (2)), +.MR 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 , was reached (see -.BR proc (5)); +.MR proc 5 ); or the maximum number of PIDs, .IR /proc/sys/kernel/pid_max , was reached (see -.BR proc (5)). +.MR proc 5 ). .TP .B EINVAL Invalid settings in @@ -136,7 +140,7 @@ No permission to set the scheduling policy and parameters specified in .IR attr . .SH ATTRIBUTES For an explanation of the terms used in this section, see -.BR attributes (7). +.MR attributes 7 . .TS allbox; lbx lb lb @@ -154,7 +158,7 @@ POSIX.1-2008. POSIX.1-2001. .SH NOTES See -.BR pthread_self (3) +.MR pthread_self 3 for further information on the thread ID returned in .I *thread by @@ -170,7 +174,7 @@ A thread may either be or .IR detached . If a thread is joinable, then another thread can call -.BR pthread_join (3) +.MR pthread_join 3 to wait for the thread to terminate and fetch its exit status. Only when a terminated joinable thread has been joined are the last of its resources released back to the system. @@ -183,7 +187,7 @@ whose exit status the application does not need to care about. By default, a new thread is created in a joinable state, unless .I attr was set to create the thread in a detached state (using -.BR pthread_attr_setdetachstate (3)). +.MR pthread_attr_setdetachstate 3 ). .P Under the NPTL threading implementation, if the .B RLIMIT_STACK @@ -192,7 +196,7 @@ soft resource limit has any value other than "unlimited", then it determines the default stack size of new threads. Using -.BR pthread_attr_setstacksize (3), +.MR pthread_attr_setstacksize 3 , the stack size attribute can be explicitly set in the .I attr argument used to create a thread, @@ -222,7 +226,7 @@ In the obsolete LinuxThreads implementation, each of the threads in a process has a different process ID. This is in violation of the POSIX threads specification, and is the source of many other nonconformances to the standard; see -.BR pthreads (7). +.MR pthreads 7 . .SH EXAMPLES The program below demonstrates the use of .BR pthread_create (), @@ -248,7 +252,7 @@ Joined with thread 3; returned value was SERVUS .in .P In the next run, the program explicitly sets a stack size of 1\ MB (using -.BR pthread_attr_setstacksize (3)) +.MR pthread_attr_setstacksize 3 ) for the created threads: .P .in +4n @@ -396,14 +400,14 @@ main(int argc, char *argv[]) .SH SEE ALSO .ad l .nh -.BR getrlimit (2), -.BR pthread_attr_init (3), -.BR pthread_cancel (3), -.BR pthread_detach (3), -.BR pthread_equal (3), -.BR pthread_exit (3), -.BR pthread_getattr_np (3), -.BR pthread_join (3), -.BR pthread_self (3), -.BR pthread_setattr_default_np (3), -.BR pthreads (7) +.MR getrlimit 2 , +.MR pthread_attr_init 3 , +.MR pthread_cancel 3 , +.MR pthread_detach 3 , +.MR pthread_equal 3 , +.MR pthread_exit 3 , +.MR pthread_getattr_np 3 , +.MR pthread_join 3 , +.MR pthread_self 3 , +.MR pthread_setattr_default_np 3 , +.MR pthreads 7 |