summaryrefslogtreecommitdiffstats
path: root/lib/libc_r/uthread/uthread_kill.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc_r/uthread/uthread_kill.c')
-rw-r--r--lib/libc_r/uthread/uthread_kill.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/lib/libc_r/uthread/uthread_kill.c b/lib/libc_r/uthread/uthread_kill.c
index eb2c6b7..f6e684b 100644
--- a/lib/libc_r/uthread/uthread_kill.c
+++ b/lib/libc_r/uthread/uthread_kill.c
@@ -39,40 +39,19 @@
int
pthread_kill(pthread_t pthread, int sig)
{
- int rval = 0;
- int status;
- pthread_t p_pthread;
+ int ret;
/* Check for invalid signal numbers: */
if (sig < 0 || sig >= NSIG)
/* Invalid signal: */
- rval = EINVAL;
- else {
- /* Assume that the search will succeed: */
- rval = 0;
+ ret = EINVAL;
- /* Block signals: */
- _thread_kern_sig_block(&status);
-
- /* Search for the thread: */
- p_pthread = _thread_link_list;
- while (p_pthread != NULL && p_pthread != pthread) {
- p_pthread = p_pthread->nxt;
- }
-
- /* Check if the thread was not found: */
- if (p_pthread == NULL)
- /* Can't find the thread: */
- rval = ESRCH;
- else
- /* Increment the pending signal count: */
- p_pthread->sigpend[sig] += 1;
-
- /* Unblock signals: */
- _thread_kern_sig_unblock(status);
- }
+ /* Find the thread in the list of active threads: */
+ else if ((ret = _find_thread(pthread)) == 0)
+ /* Increment the pending signal count: */
+ sigaddset(&pthread->sigpend,sig);
/* Return the completion status: */
- return (rval);
+ return (ret);
}
#endif
OpenPOWER on IntegriCloud