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.
A system limit is exceeded, such as when too many threads have been created.
The value of tattr is invalid.
The caller does not have appropriate permission to set the required scheduling parameters or scheduling policy.