This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 8dba0bb52ef65ed3a415967012a93e923009545a Author: Marco Casaroli <[email protected]> AuthorDate: Wed Oct 28 11:54:31 2026 +0100 sched/signal: Let an interrupt handler use the reserved pending signals. NuttX keeps pending signal structures for interrupt handlers (CONFIG_SIG_PREALLOC_IRQ_ACTIONS), and nxsig_alloc_pendingsignal() and nxsig_alloc_pendingsigaction() take them in an interrupt when the free lists are empty. But nxsig_alloc_dyn_pending() returned EAGAIN in an interrupt as soon as a free list was empty, so the reserved structures were never used: when other tasks held the few preallocated pending signals, every signal sent from an interrupt handler (a POSIX timer, a driver notification) failed. In an interrupt, fail only when a needed free list and its reserve are both empty. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- sched/signal/sig_dispatch.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c index 7fbfa3cfd88..93265434d13 100644 --- a/sched/signal/sig_dispatch.c +++ b/sched/signal/sig_dispatch.c @@ -405,9 +405,30 @@ static int nxsig_alloc_dyn_pending(FAR irqstate_t *flags) FAR sigq_t *sigq = NULL; #endif - /* We can't do memory allocations in idle task or interrupt */ + /* We can't do memory allocations in idle task or interrupt. An + * interrupt handler takes the structures reserved for it + * (nxsig_alloc_pendingsignal(), nxsig_alloc_pendingsigaction()), if + * any are left. + */ + + if (up_interrupt_context()) + { + if (alloc_signal && sq_empty(&g_sigpendingirqsignal)) + { + return -EAGAIN; + } + +#ifdef CONFIG_ENABLE_ALL_SIGNALS + if (alloc_sigact && sq_empty(&g_sigpendingirqaction)) + { + return -EAGAIN; + } +#endif + + return OK; + } - if (up_interrupt_context() || sched_idletask()) + if (sched_idletask()) { return -EAGAIN; }
