pthread_cond_init() returns zero after completing successfully. Any other return value indicates that an error occurred. When any of the following conditions occurs, the function fails and returns the corresponding value.
The value specified by cattr is invalid.
The condition variable is being used.
The necessary resources are not available.
Insufficient memory exists to initialize the condition variable.