X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fpthread_kill.c;h=3d9395cb7e0a0b5797c962e4af2d22d95de93718;hb=c0058ab465e950c2c3302d2b62e21cc0b494224b;hp=a24ecc20576f846dd64a4e7ae707b3d8d5148cc3;hpb=7779dbd2663269b465951189b4f43e70839bc073;p=musl diff --git a/src/thread/pthread_kill.c b/src/thread/pthread_kill.c index a24ecc20..3d9395cb 100644 --- a/src/thread/pthread_kill.c +++ b/src/thread/pthread_kill.c @@ -1,10 +1,12 @@ #include "pthread_impl.h" +#include "lock.h" int pthread_kill(pthread_t t, int sig) { int r; - __lock(&t->killlock); - r = t->dead ? ESRCH : -__syscall(SYS_tgkill, t->pid, t->tid, sig); - a_store(&t->killlock, 0); + LOCK(t->killlock); + r = t->tid ? -__syscall(SYS_tkill, t->tid, sig) + : (sig+0U >= _NSIG ? EINVAL : 0); + UNLOCK(t->killlock); return r; }