• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "pthread_impl.h"
2 #include "lock.h"
3 
pthread_setschedparam(pthread_t t,int policy,const struct sched_param * param)4 int pthread_setschedparam(pthread_t t, int policy, const struct sched_param *param)
5 {
6 	int r;
7 
8 	if (policy != SCHED_RR && policy != SCHED_FIFO) {
9 		return EINVAL;
10 	}
11 
12 	if (param->sched_priority < 0 || param->sched_priority > PTHREAD_PRIORITY_LOWEST) {
13 		return EINVAL;
14 	}
15 
16 	LOCK(t->killlock);
17 	r = !t->tid ? ESRCH : -__syscall(SYS_sched_setscheduler, t->tid, policy, param->sched_priority, MUSL_TYPE_THREAD);
18 	UNLOCK(t->killlock);
19 	return r;
20 }
21