From 32bac84548078ca697bcfa6154902288d6c61b88 Mon Sep 17 00:00:00 2001 From: igd Date: Mon, 26 Aug 2019 10:54:49 -0600 Subject: [PATCH] sched/Kconfig, sched/signal/sig_notification.c: Add configuration option to decide select either the high-priority or low-priority work queue for SIG_EVTHREAD notifications. --- sched/Kconfig | 13 +++++++++++++ sched/signal/sig_notification.c | 10 ++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/sched/Kconfig b/sched/Kconfig index 90cc7b42c20..430f62316fe 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -1340,6 +1340,19 @@ config SIG_EVTHREAD different mechanism would need to be development to support this feature on the PROTECTED or KERNEL build. +config SIG_EVTHREAD_HPWORK + bool "SIGEV_EVTHREAD use HPWORK" + default n + depends on SIG_EVTHREAD && CONFIG_SCHED_HPWORK + ---help--- + if selected, SIGEV_THHREAD will use the high priority work queue. + If not, it will use the low priority work queue (if available). + + REVISIT: This solution is non-optimal. Some notifications should + be high priority and others should be lower priority. Ideally, you + should be able to determine which work queue is used on a + notification-by-notification basis. + menuconfig SIG_DEFAULT bool "Default signal actions" default n diff --git a/sched/signal/sig_notification.c b/sched/signal/sig_notification.c index 38c1059718a..68b0fb7ded6 100644 --- a/sched/signal/sig_notification.c +++ b/sched/signal/sig_notification.c @@ -53,6 +53,12 @@ #include "sched/sched.h" #include "signal/signal.h" +#ifdef CONFIG_SIG_EVTHREAD_HPWORK +# define SIG_EVTHREAD_WORK HPWORK +#else +# define SIG_EVTHREAD_WORK LPWORK +#endif + /**************************************************************************** * Name: nxsig_notification_worker * @@ -166,7 +172,7 @@ int nxsig_notification(pid_t pid, FAR struct sigevent *event, /* Then queue the work */ - return work_queue(LPWORK, &work->work, + return work_queue(SIG_EVTHREAD_WORK, &work->work, nxsig_notification_worker, work, 0); } #endif @@ -191,6 +197,6 @@ int nxsig_notification(pid_t pid, FAR struct sigevent *event, #ifdef CONFIG_SIG_EVTHREAD void nxsig_cancel_notification(FAR struct sigwork_s *work) { - work_cancel(LPWORK, &work->work); + work_cancel(SIG_EVTHREAD_WORK, &work->work); } #endif