pthread_create() returns zero when the call completes successfully. Any other return value indicates that an error occurred. When any of the following conditions are detected, pthread_create() fails and returns the corresponding value.
EAGAIN
Description:A system limit is exceeded, such as when too many threads have been created.
EINVAL
Description:The value of tattr is invalid.
EPERM
Description:The caller does not have appropriate permission to set the required scheduling parameters or scheduling policy.