pussuw commented on code in PR #8740:
URL: https://github.com/apache/nuttx/pull/8740#discussion_r1127747250
##########
sched/signal/sig_dispatch.c:
##########
@@ -373,11 +373,11 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t
*info)
#endif
{
#ifdef CONFIG_LIB_SYSCALL
- /* If the thread is in syscall, schedule the sigaction here */
+ /* If the thread is in syscall, queue the sigaction here */
- if ((stcb->flags & TCB_FLAG_SYSCALL) != 0)
+ if (masked == 0)
Review Comment:
Just to clarify a bit more, if you take a look into the unmasked signal
handling, the first thing that is done is a signal *action* is queued. Then if
the task is waiting for a signal it is also unblocked / woken up. This way the
sigunbmask is received by sigwait() and if a signal action handler is installed
by the user, it also gets called. This is logical to me.
https://github.com/apache/nuttx/blob/fce927123ed243426814f38b6e89b82ac859a7bc/sched/signal/sig_dispatch.c#L434-L475
The masked signal handling is not clear to me. The task is woken up by this,
but no signal action is added anywhere. So the user handler is never called,
even if the procmask changes.
https://github.com/apache/nuttx/blob/0e4466682888cf32ca661aa04c649a836860a22f/sched/signal/sig_dispatch.c#L389-L426
This is what I don't understand and I think there is an error here, i.e.
depending on whether this is true / false, the signal action is properly queued
or not, and the user handler is either called (when sigprocmask changes) or not.
```
if (stcb->task_state == TSTATE_WAIT_SIG &&
(masked == 0 ||
nxsig_ismember(&stcb->sigwaitmask, info->si_signo)))
```
Please note that `nxsig_add_pendingsignal` both wakes up the task when
sigprocmask changes _AND_ queues the signal action, meaning the signal handler
is called also.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]