diff --git a/sched/pthread/pthread_kill.c b/sched/pthread/pthread_kill.c index cf5d0684592..b6ca8ab74d8 100644 --- a/sched/pthread/pthread_kill.c +++ b/sched/pthread/pthread_kill.c @@ -45,6 +45,8 @@ #include #include +#include + #include "signal/signal.h" /************************************************************************ @@ -82,6 +84,14 @@ int pthread_kill(pthread_t thread, int signo) { +#ifdef HAVE_GROUP_MEMBERS + /* If group members are support then pthread_kill() differs from kill(). + * kill(), in this case, must following the POSIX rules for delivery of + * signals in the group environment. Otherwise, kill(), like + * pthread_kill() will just deliver the signal to the thread ID it is + * requested to use. + */ + #ifdef CONFIG_SCHED_HAVE_PARENT FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head; #endif @@ -138,4 +148,21 @@ errout_with_lock: sched_unlock(); errout: return -ret; + +#else + /* If group members are not supported then pthread_kill is basically the + * same as kill(). + */ + + int ret; + + set_errno(EINVAL); + ret = kill((pid_t)thread, signo); + if (ret != OK) + { + ret = get_errno(); + } + + return ret; +#endif } diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c index 1985fc7f27b..2113487e550 100644 --- a/sched/signal/sig_dispatch.c +++ b/sched/signal/sig_dispatch.c @@ -445,7 +445,6 @@ int sig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) int sig_dispatch(pid_t pid, FAR siginfo_t *info) { #ifdef HAVE_GROUP_MEMBERS - FAR struct tcb_s *stcb; FAR struct task_group_s *group; @@ -486,7 +485,6 @@ int sig_dispatch(pid_t pid, FAR siginfo_t *info) } #else - FAR struct tcb_s *stcb; /* Get the TCB associated with the pid */