split internal lock API out of libc.h, creating lock.h
[musl] / src / thread / pthread_getschedparam.c
1 #include "pthread_impl.h"
2 #include "lock.h"
3
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, param);
12                 if (!r) {
13                         *policy = __syscall(SYS_sched_getscheduler, t->tid);
14                 }
15         }
16         UNLOCK(t->killlock);
17         return r;
18 }