improve pthread_exit synchronization with functions targeting tid
[musl] / src / thread / pthread_setschedprio.c
index dc745b4..c353f6b 100644 (file)
@@ -4,7 +4,7 @@ int pthread_setschedprio(pthread_t t, int prio)
 {
        int r;
        LOCK(t->killlock);
-       r = t->dead ? ESRCH : -__syscall(SYS_sched_setparam, t->tid, &prio);
+       r = !t->tid ? ESRCH : -__syscall(SYS_sched_setparam, t->tid, &prio);
        UNLOCK(t->killlock);
        return r;
 }