sched/wqueue/kwork_notifier.c and several Kconfig files: Notifier should work with either lpwork or hpwork and other minor typo fix.

This commit is contained in:
Xiang Xiao 2019-01-27 11:02:56 -06:00 committed by Gregory Nutt
parent 7310fb7018
commit fe421022e2
7 changed files with 19 additions and 19 deletions

View file

@ -245,7 +245,7 @@
/* Kernel mode */
# define HPWORK 0 /* High priority, kernel-mode work queue */
# ifdef CONFIG_SCHED_LPWORK
# if defined(CONFIG_SCHED_LPWORK) && defined(CONFIG_SCHED_HPWORK)
# define LPWORK (HPWORK+1) /* Low priority, kernel-mode work queue */
# else
# define LPWORK HPWORK /* Redirect low-priority references */

View file

@ -62,7 +62,7 @@ config IOB_THROTTLE
config IOB_NOTIFIER
bool "Support IOB notifications"
default n
depends on SCHED_HPWORK
depends on SCHED_WORKQUEUE
select WQUEUE_NOTIFIER
---help---
Enable building of IOB notifier logic that will execute a worker

View file

@ -39,7 +39,7 @@ config NETDEV_IFINDEX
config NETDOWN_NOTIFIER
bool "Support network down notifications"
default n
depends on SCHED_LPWORK
depends on SCHED_WORKQUEUE
select WQUEUE_NOTIFIER
---help---
Enable building of logic that will execute on the low priority work

View file

@ -50,7 +50,7 @@ config NET_MAX_LISTENPORTS
config TCP_NOTIFIER
bool "Support TCP notifications"
default n
depends on SCHED_LPWORK
depends on SCHED_WORKQUEUE
select WQUEUE_NOTIFIER
---help---
Enable building of TCP notifier logic that will execute a worker

View file

@ -60,7 +60,7 @@ config NET_UDP_READAHEAD
config UDP_READAHEAD_NOTIFIER
bool "Support UDP read-ahead notifications"
default n
depends on NET_UDP_READAHEAD && SCHED_HPWORK
depends on NET_UDP_READAHEAD && SCHED_WORKQUEUE
select WQUEUE_NOTIFIER
---help---
Enable building of UDP read-ahead notifier logic that will execute a

View file

@ -1469,6 +1469,16 @@ config SCHED_WORKQUEUE
Create dedicated "worker" threads to handle delayed or asynchronous
processing.
config WQUEUE_NOTIFIER
bool "Generic work notifier"
default n
depends on SCHED_WORKQUEUE
---help---
Enable building of work queue notifier logic that will execute a
worker function an event occurs. This is is a general purpose
notifier, but was developed specifically to support poll() logic
where the poll must wait for an resources to become available.
config SCHED_HPWORK
bool "High priority (kernel) worker thread"
default n
@ -1534,15 +1544,6 @@ config SCHED_HPWORKSTACKSIZE
---help---
The stack size allocated for the worker thread. Default: 2K.
config WQUEUE_NOTIFIER
bool "Generic work notifier"
default n
---help---
Enable building of work queue notifier logic that will execute a
worker function an event occurs. This is is a general purpose
notifier, but was developed specifically to support poll() logic
where the poll must wait for an resources to become available.
endif # SCHED_HPWORK
config SCHED_LPWORK

View file

@ -211,7 +211,7 @@ int work_notifier_setup(FAR struct work_notifier_s *info)
*/
dq_addlast((FAR dq_entry_t *)notifier, &g_notifier_pending);
ret = work_notifier_key();
ret = notifier->key;
}
(void)nxsem_post(&g_notifier_sem);
@ -310,11 +310,12 @@ void work_notifier_signal(enum work_evtype_e evtype,
/* Get exclusive access to the notifier data structure */
ret = nxsem_wait(&g_notifier_sem);
while (ret < 0)
do
{
ret = nxsem_wait(&g_notifier_sem);
DEBUGASSERT(ret == -EINTR || ret == -ECANCELED);
}
while (ret < 0);
/* Don't let any newly started threads block this thread until all of
* the notifications and been sent.
@ -325,8 +326,6 @@ void work_notifier_signal(enum work_evtype_e evtype,
/* Process the notification at the head of the pending list until the
* pending list is empty */
/* Find the entry matching this key in the g_notifier_pending list. */
for (entry = dq_peek(&g_notifier_pending);
entry != NULL;
entry = next)