• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "pthread_impl.h"
2 #include "lock.h"
3 
pthread_setschedprio(pthread_t t,int prio)4 int pthread_setschedprio(pthread_t t, int prio)
5 {
6 	int r;
7 #ifdef __LITEOS_A__
8 	struct sched_param param = {
9 		.sched_priority = prio,
10 	};
11 #endif
12 
13 	sigset_t set;
14 	__block_app_sigs(&set);
15 	LOCK(t->killlock);
16 #ifdef __LITEOS_A__
17 	r = !t->tid ? ESRCH : -__syscall(SYS_sched_setparam, t->tid, &param, MUSL_TYPE_THREAD);
18 #else
19 	r = !t->tid ? ESRCH : -__syscall(SYS_sched_setparam, t->tid, &prio);
20 #endif
21 	UNLOCK(t->killlock);
22 	__restore_sigs(&set);
23 	return r;
24 }
25