sched/signal: Move nxsig_find_action outside of critical section

The TCB used in find_action is locked by spinlock, so it doesn't belong
inside critical section. Just find the possible action already in the
beginning of nxsig_tcbdispatch.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
Jukka Laitinen 2025-05-05 15:21:56 +03:00 committed by Xiang Xiao
parent e67247843d
commit 77df55db45

View file

@ -110,18 +110,15 @@ static int sig_handler(FAR void *cookie)
*
****************************************************************************/
static int nxsig_queue_action(FAR struct tcb_s *stcb, siginfo_t *info)
static int nxsig_queue_action(FAR struct tcb_s *stcb,
FAR sigactq_t *sigact,
FAR siginfo_t *info)
{
FAR sigactq_t *sigact;
FAR sigq_t *sigq;
int ret = OK;
DEBUGASSERT(stcb != NULL && stcb->group != NULL);
/* Find the group sigaction associated with this signal */
sigact = nxsig_find_action(stcb->group, info->si_signo);
/* Check if a valid signal handler is available and if the signal is
* unblocked. NOTE: There is no default action.
*/
@ -403,6 +400,7 @@ static FAR sigpendq_t *nxsig_add_pendingsignal(FAR struct tcb_s *stcb,
int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
{
FAR struct tcb_s *rtcb = this_task();
FAR sigactq_t *sigact;
irqstate_t flags;
int masked;
int ret = OK;
@ -431,6 +429,10 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
/************************** MASKED SIGNAL ACTIONS *************************/
/* Find if there is a group sigaction associated with this signal */
sigact = nxsig_find_action(stcb->group, info->si_signo);
flags = enter_critical_section();
masked = nxsig_ismember(&stcb->sigprocmask, info->si_signo);
@ -529,7 +531,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
{
/* Queue any sigaction's requested by this task. */
ret = nxsig_queue_action(stcb, info);
ret = nxsig_queue_action(stcb, sigact, info);
/* Deliver of the signal must be performed in a critical section */