为什么无法使用内核服务从 NMI 处理程序内部发出任务信号?

Why is it not possible to signal a task from inside an NMI handler using kernel services?

在阅读 uCOS-II 文档时,我读到不能使用内核提供的机制从 NMI 内部发出任务信号,我不清楚为什么。

谢谢。

编辑:

来源:uc/OS-II 实时内核用户手册,第 2 章:实时系统概念,第 86 页:

When you are servicing an NMI, you cannot use kernel services to signal a task because NMIs cannot be disabled to access critical sections of code. However you can still pass parameters to and from the NMI.

MicroC/OS-II The Real Time Kernel 2nd ed. 解释了推理(虽然相当简短):

2.31 Nonmaskable Interrupts

[...] When you are servicing an NMI, you cannot use kernel services to signal a task because NMIs cannot be disabled to access critical sections of code. [...]

这可能是一个问题的原因可能并不明显,但如果线程进入临界区并且发生 NMI,调用内核服务来发出任务信号将导致调用调度程序并导致上下文在中断的临界区内切换。