1 .TH PTHREAD_CREATE 3 LinuxThreads
4 pthread_create \- create a new thread
9 int pthread_create(pthread_t * thread, pthread_attr_t * attr, void * (*start_routine)(void *), void * arg);
12 !pthread_create! creates a new thread of control that executes
13 concurrently with the calling thread. The new thread applies the
14 function |start_routine| passing it |arg| as first argument. The new
15 thread terminates either explicitly, by calling !pthread_exit!(3),
16 or implicitly, by returning from the |start_routine| function. The
17 latter case is equivalent to calling !pthread_exit!(3) with the result
18 returned by |start_routine| as exit code.
20 The |attr| argument specifies thread attributes to be applied to the
21 new thread. See !pthread_attr_init!(3) for a complete list of thread
22 attributes. The |attr| argument can also be !NULL!, in which case
23 default attributes are used: the created thread is joinable (not
24 detached) and has default (non real-time) scheduling policy.
27 On success, the identifier of the newly created thread is stored in
28 the location pointed by the |thread| argument, and a 0 is returned. On
29 error, a non-zero error code is returned.
34 not enough system resources to create a process for the new thread.
37 more than !PTHREAD_THREADS_MAX! threads are already active.
40 Xavier Leroy <Xavier.Leroy@inria.fr>
46 !pthread_attr_init!(3).