split internal lock API out of libc.h, creating lock.h
[musl.git] / src / thread / pthread_getschedparam.c
blob1cba073d0c7d549023e2b5cc7faeb1ec8faa401e
1 #include "pthread_impl.h"
2 #include "lock.h"
4 int pthread_getschedparam(pthread_t t, int *restrict policy, struct sched_param *restrict param)
6 int r;
7 LOCK(t->killlock);
8 if (!t->tid) {
9 r = ESRCH;
10 } else {
11 r = -__syscall(SYS_sched_getparam, t->tid, param);
12 if (!r) {
13 *policy = __syscall(SYS_sched_getscheduler, t->tid);
16 UNLOCK(t->killlock);
17 return r;