Manual Pages for UNIX Darwin command on man pthread_create
MyWebUniversity

Manual Pages for UNIX Darwin command on man pthread_create

PTHREADCREATE(3) BSD Library Functions Manual PTHREADCREATE(3)

NAME

pptthhrreeaaddccrreeaattee - create a new thread

SYNOPSIS

##iinncclluuddee <>

int pptthhrreeaaddccrreeaattee(pthreadt *thread, const pthreadattrt *attr, void *(*startroutine)(void *), void *arg);

DESCRIPTION

The pptthhrreeaaddccrreeaattee() function is used to create a new thread, with attributes specified by attr, within a process. If attr is NULL, the default attributes are used. If the attributes specified by attr are

modified later, the thread's attributes are not affected. Upon success-

ful completion pptthhrreeaaddccrreeaattee() will store the ID of the created thread in the location specified by thread.

The thread is created executing startroutine with arg as its sole argu-

ment. If the startroutine returns, the effect is as if there was an implicit call to pptthhrreeaaddeexxiitt() using the return value of startroutine as the exit status. Note that the thread in which mmaaiinn() was originally invoked differs from this. When it returns from mmaaiinn(), the effect is as if there was an implicit call to eexxiitt() using the return value of mmaaiinn() as the exit status. The signal state of the new thread is initialized as: ++oo The signal mask is inherited from the creating thread. ++oo The set of signals pending for the new thread is empty.

RETURN VALUES

If successful, the pptthhrreeaaddccrreeaattee() function will return zero. Other-

wise an error number will be returned to indicate the error. EERRRROORRSS pptthhrreeaaddccrreeaattee() will fail if: [EAGAIN] The system lacked the necessary resources to create

another thread, or the system-imposed limit on the

total number of threads in a process [PTHREADTHREADSMAX] would be exceeded. [EINVAL] The value specified by attr is invalid.

SEE ALSO

fork(2), pthreadcleanuppop(3), pthreadcleanuppush(3), pthreadexit(3), pthreadjoin(3) STANDARDS

pptthhrreeaaddccrreeaattee() conforms to ISO/IEC 9945-1:1996 (``POSIX.1'').

BSD April 4, 1996 BSD




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™