xiaoxiang781216 commented on a change in pull request #1663:
URL: https://github.com/apache/incubator-nuttx/pull/1663#discussion_r479759482
##########
File path: arch/sim/src/sim/up_hostirq.c
##########
@@ -86,3 +112,44 @@ void up_irq_restore(uint64_t flags)
void up_irqinitialize(void)
{
}
+
+/****************************************************************************
+ * Name: up_enable_irq
+ *
+ * Description:
+ * Enable the IRQ specified by 'irq'
+ *
+ ****************************************************************************/
+
+void up_enable_irq(int irq)
+{
+ struct sigaction act;
+ sigset_t set;
+
+ /* Register signal handler */
+
+ memset(&act, 0, sizeof(act));
+ act.sa_sigaction = up_handle_irq;
+ act.sa_flags = SA_SIGINFO;
+ sigfillset(&act.sa_mask);
+ sigaction(irq, &act, NULL);
+
+ /* Unmask the signal */
+
+ sigemptyset(&set);
+ sigaddset(&set, irq);
+ pthread_sigmask(SIG_UNBLOCK, &set, NULL);
+}
+
+/****************************************************************************
+ * Name: up_disable_irq
+ *
+ * Description:
+ * Disable the IRQ specified by 'irq'
+ *
+ ****************************************************************************/
+
+void up_disable_irq(int irq)
+{
+ signal(irq, SIG_IGN);
Review comment:
pthread_sigmask can only block the current thread, it's hard to block
all threads directly with signal API. Anyway I will change the code to match
up_enable_irq.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]