If an error condition occurs, no thread is created, the contents
of thread are undefined, and this routine returns an integer
value indicating the type of error. Possible return values are as
follows:
Return Description
0 Successful completion.
[EAGAIN] The system lacks the necessary resources to create
another thread, or the system-imposed limit on the
total number of threads under execution by a single
user is exceeded.
[EINVAL] The value specified by attr is not a valid attributes
block.
[ENOMEM] Insufficient memory exists to create a thread.
[EPERM] The caller does not have the appropriate permission
to create a thread with the specified attributes.