pthread_setschedparam() returns zero after completing successfully. Any other return value indicates that an error occurred. When either of the following conditions occurs, the pthread_setschedparam() function fails and returns the corresponding value.
The value of the attribute being set is not valid.
The caller does not have the appropriate permission to set either the scheduling parameters or the scheduling policy of the specified thread.
The value specified by tid does not refer to an existing thread.