pthread_create(3P)
pthread_create - create and start a thread
As shipped in IRIX 6.5.30. Last changed in IRIX 6.5.15.
NAME pthread_create - create and start a thread C SYNOPSIS #include <pthread.h> int pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start)(void *), void *arg); DESCRIPTION The pthread_create() function creates a thread with the attributes specified by attr, starting execution at the function named start with the argument value arg. A null value of attr causes the thread to be created with default attributes. The thread identity is saved in the location pointed to by the thread argument. A new thread inherits its per-thread signal mask from its creator. No signals are pending on the thread when it starts. The thread runs until it returns from its start function, calls pthread_exit(), or acts on a cancellation request. The exception is the initial thread which will cause the process to exit if it returns from main(). When the process terminates so do all its threads. For an overview of POSIX threads see pthreads(5). DIAGNOSTICS On success, pthread_create() returns zero; otherwise an error number is returned: [EAGAIN] The maximum number of threads has been created [see NOTES, and setrlimit()] or there is insufficient memory to create the thread. [EPERM] The calling process lacks sufficient privilege to create a thread with these attributes [see pthread_attr_setscope()]. [EPERM] A call to pthread_create() was attempted from a sproc program (see CAVEATS, section below). [EPERM] A call to pthread_create() was attempted with a priority that is outside of the valid range (see CAVEATS, section below). [ENOSYS] A call to pthread_create() was made from an executable which is not linked against the POSIX threads library. This typically occurs when the argument "-lpthread" is accidentally omitted during compilation of the executable. NOTES A thread application can find the thread limit using the sysconf() function with the _SC_THREAD_THREADS_MAX option. CAVEATS The POSIX thread model is incompatible with the sproc(2) model of threading. Attempts to create a pthread process from a sproc program will be rejected. Attempts to create a pthread process at a priority outside of the valid range will be rejected. Specifically, weightless is not a valid pthread priority. For more information about these and other limitations with the POSIX thread model see pthreads(5). SEE ALSO pthread_attr_init(3P), pthread_attr_setscope(3P), pthread_exit(3P), pthreads(5), setrlimit(2), sysconf(3C).