synccall: add separate exit_sem to fix thread release logic bug
[musl.git] / src / thread / pthread_getschedparam.c
blobc098befb1b7f042efefbf63d516a26577ac3f27d
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 sigset_t set;
8 __block_app_sigs(&set);
9 LOCK(t->killlock);
10 if (!t->tid) {
11 r = ESRCH;
12 } else {
13 r = -__syscall(SYS_sched_getparam, t->tid, param);
14 if (!r) {
15 *policy = __syscall(SYS_sched_getscheduler, t->tid);
18 UNLOCK(t->killlock);
19 __restore_sigs(&set);
20 return r;