acassis commented on code in PR #17263:
URL: https://github.com/apache/nuttx/pull/17263#discussion_r2479146276
##########
sched/signal/sig_dispatch.c:
##########
@@ -364,11 +364,10 @@ static irqstate_t nxsig_alloc_dyn_pending(irqstate_t
flags)
bool alloc_signal = sq_empty(&g_sigpendingsignal);
bool alloc_sigact = sq_empty(&g_sigpendingaction);
- /* Signals are not dispatched from the idle task */
+ /* We can't do memory allocations in idle task or interrupt */
- DEBUGASSERT(!sched_idletask());
-
- if (alloc_signal || alloc_sigact)
+ if ((alloc_signal || alloc_sigact) &&
+ !sched_idletask() && !up_interrupt_context())
Review Comment:
Asking this question to google, I got this response from gemini:
```
While not strictly forbidden, dispatching a POSIX signal from an interrupt
service routine (ISR) is generally a bad idea and is not portable. Most POSIX
systems strongly discourage calling functions that are not async-signal-safe
from an ISR. Doing so can lead to non-deterministic, and often catastrophic,
system behavior, including race conditions and deadlocks.
```
I don't know if our signal implementation is "async-signal-safe", maybe you
are right, we should remove it. But then we need to fix the zerocross or remove
it and all support from boards that use it. :-(
--
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]