PTHREAD_CREATE(3) BSD Programmer's Manual PTHREAD_CREATE(3)NAMEpthread_create - create a new pthread
SYNOPSIS
#include <pthread.h>
int
pthread_create(pthread_t *tid, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg);
DESCRIPTION
This interface is defined by IEEE Std1003.1c (``POSIX'').
The pthread_create() function creates a new pthread using the thread cre-
ation attributes defined by the attribute object attr. If attr is NULL,
the default creation attributes are used. The thread is created using
start_routine as the initial function to execute with arg passed as the
sole argument to start_routine. If the thread exits start_routine, the
effect shall be the same as the thread calling pthread_exit() with the
return value of start_routine as the value passed to pthread_exit().
Upon successful completion, the pthread_create() function returns the
thread id of the newly created thread in tid.
RETURN VALUES
The pthread_create() function returns 0 upon successful completion. If
an error occurs, a non-zero error value is returned.
ERRORS
The pthread_create function may fail and return one of the following er-
rors:
[EAGAIN] The system lacked the necessary resources to create another
thread.
[EINVAL] The value specified by attr is invalid.
SEE ALSOpthreads(3), pthread_exit(3)STANDARDS
The pthread_create function conforms to IEEE Std1003.1c (``POSIX'').
HISTORY
The pthread_create function first appeared in BSD/OS 3.0.
4th Berkeley Distribution June 3, 1996 1