/* Get thread scheduling policy and parameters. 
See IEEE 1003.1  */
int pthread_getschedparam(pthread_t pthread, int *policy, struct sched_param *param)
/* Get thread scheduling policy and parameters. 
See IEEE 1003.1  */
int pthread_getschedparam(pthread_t pthread, int *policy, struct sched_param *param)
{
	int ret = 0;
	struct posix_thread *t;
	if (policy == NULL || param == NULL) {
		return EINVAL;
	}
	K_SPINLOCK(&pthread_pool_lock) {
		t = to_posix_thread(pthread);
		if (t == NULL) {
			ret = ESRCH;
			K_SPINLOCK_BREAK;
		}
		if (!__attr_is_initialized(&t->attr)) {
			ret = ESRCH;
			K_SPINLOCK_BREAK;
		}
		param->sched_priority =
			zephyr_to_posix_priority(k_thread_priority_get(&t->thread), policy);
	}
	return ret;
}