/* Set scheduling parameter attributes in thread attributes object. 
See IEEE 1003.1  */
int pthread_attr_setschedparam(pthread_attr_t *_attr, const struct sched_param *schedparam)
/* Set scheduling parameter attributes in thread attributes object. 
See IEEE 1003.1  */
int pthread_attr_setschedparam(pthread_attr_t *_attr, const struct sched_param *schedparam)
{
	struct posix_thread_attr *attr = (struct posix_thread_attr *)_attr;
	if (!__attr_is_initialized(attr) || schedparam == NULL ||
	    !is_posix_policy_prio_valid(schedparam->sched_priority, attr->schedpolicy)) {
		LOG_ERR("Invalid pthread_attr_t or sched_param");
		return EINVAL;
	}
	attr->priority = schedparam->sched_priority;
	return 0;
}