• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "pthread_impl.h"
2 #include "lock.h"
3 
pthread_getschedparam(pthread_t t,int * restrict policy,struct sched_param * restrict param)4 int pthread_getschedparam(pthread_t t, int *restrict policy, struct sched_param *restrict param)
5 {
6 	int r;
7 	LOCK(t->killlock);
8 	if (!t->tid) {
9 		r = ESRCH;
10 	} else {
11 		r = __syscall(SYS_sched_getparam, t->tid, MUSL_TYPE_THREAD);
12 		if (r >= 0) {
13 			param->sched_priority = r;
14 			r = __syscall(SYS_sched_getscheduler, t->tid, MUSL_TYPE_THREAD);
15 			if (r >= 0) {
16 				*policy = r;
17 				r = 0;
18 			}
19 		}
20 
21 		if (r < 0) {
22 			r = -r;
23 		}
24 	}
25 	UNLOCK(t->killlock);
26 	return r;
27 }
28