diff options
Diffstat (limited to 'nuttx/sched')
-rw-r--r-- | nuttx/sched/Kconfig | 68 | ||||
-rw-r--r-- | nuttx/sched/os_bringup.c | 38 |
2 files changed, 31 insertions, 75 deletions
diff --git a/nuttx/sched/Kconfig b/nuttx/sched/Kconfig index 61900f498..b7561ff58 100644 --- a/nuttx/sched/Kconfig +++ b/nuttx/sched/Kconfig @@ -245,74 +245,6 @@ config SDCLONE_DISABLE desciptors by task_create() when a new task is started. If set, all sockets will appear to be closed in the new task. -config SCHED_WORKQUEUE - bool "Enable worker thread" - default n - depends on !DISABLE_SIGNALS - ---help--- - Create a dedicated "worker" thread to handle delayed processing from interrupt - handlers. This feature is required for some drivers but, if there are no - complaints, can be safely disabled. The worker thread also performs - garbage collection -- completing any delayed memory deallocations from - interrupt handlers. If the worker thread is disabled, then that clean up will - be performed by the IDLE thread instead (which runs at the lowest of priority - and may not be appropriate if memory reclamation is of high priority). - -config SCHED_WORKPRIORITY - int "Worker thread priority" - default 192 - depends on SCHED_WORKQUEUE - ---help--- - The execution priority of the worker thread. Default: 192 - -config SCHED_WORKPERIOD - int "Worker thread period" - default 50000 - depends on SCHED_WORKQUEUE - ---help--- - How often the worker thread checks for work in units of microseconds. - Default: 50*1000 (50 MS). - -config SCHED_WORKSTACKSIZE - int "Worker thread stack size" - default 2048 - depends on SCHED_WORKQUEUE - ---help--- - The stack size allocated for the worker thread. Default: 2K. - -config SCHED_LPWORK - bool "Enable a lower priority worker thread" - default n - depends on SCHED_WORKQUEUE - ---help--- - If SCHED_WORKQUEUE is defined, then a single work queue is created by - default. If SCHED_LPWORK is also defined then an additional, lower- - priority work queue will also be created. This lower priority work - queue is better suited for more extended processing (such as file system - clean-up operations) - -config SCHED_LPWORKPRIORITY - int "Lower priority worker thread priority" - default 50 - depends on SCHED_LPWORK - ---help--- - The execution priority of the lopwer priority worker thread. Default: 192 - -config SCHED_LPWORKPERIOD - int "Lower priority worker thread period" - default 50000 - depends on SCHED_LPWORK - ---help--- - How often the lower priority worker thread checks for work in units - of microseconds. Default: 50*1000 (50 MS). - -config SCHED_LPWORKSTACKSIZE - int "Lower priority worker thread stack size" - default 2048 - depends on SCHED_LPWORK - ---help--- - The stack size allocated for the lower priority worker thread. Default: 2K. - config SCHED_WAITPID bool "Enable waitpid() API" default n diff --git a/nuttx/sched/os_bringup.c b/nuttx/sched/os_bringup.c index 506de8dc3..2fcb9ff7b 100644 --- a/nuttx/sched/os_bringup.c +++ b/nuttx/sched/os_bringup.c @@ -62,11 +62,26 @@ * Pre-processor Definitions ****************************************************************************/ -/* If NuttX is built as a separately compiled module, then the the header +/* If NuttX is built as a separately compiled module, then the config.h header * file should contain the address of the user module entry point. If not * then the default entry point is user_start. */ +/* Customize some strings */ + +#ifdef CONFIG_SCHED_WORKQUEUE +# ifdef CONFIG_SCHED_HPWORK +# if defined(CONFIG_SCHED_LPWORK) +# define HPWORKNAME "hpwork" +# define LPWORKNAME "lpwork" +# elif defined(CONFIG_SCHED_USRWORK) +# define HPWORKNAME "knlwork" +# else +# define HPWORKNAME "work" +# endif +# endif +#endif + /**************************************************************************** * Private Types ****************************************************************************/ @@ -147,9 +162,15 @@ int os_bringup(void) */ #ifdef CONFIG_SCHED_WORKQUEUE - svdbg("Starting worker thread\n"); +#ifdef CONFIG_SCHED_HPWORK - g_work[HPWORK].pid = KERNEL_THREAD("work0", CONFIG_SCHED_WORKPRIORITY, +#ifdef CONFIG_SCHED_LPWORK + svdbg("Starting high-priority kernel worker thread\n"); +#else + svdbg("Starting kernel worker thread\n"); +#endif + + g_work[HPWORK].pid = KERNEL_THREAD(HPWORKNAME, CONFIG_SCHED_WORKPRIORITY, CONFIG_SCHED_WORKSTACKSIZE, (main_t)work_hpthread, (FAR char * const *)NULL); ASSERT(g_work[HPWORK].pid > 0); @@ -159,14 +180,17 @@ int os_bringup(void) */ #ifdef CONFIG_SCHED_LPWORK - svdbg("Starting worker thread\n"); - g_work[LPWORK].pid = KERNEL_THREAD("work1", CONFIG_SCHED_LPWORKPRIORITY, + svdbg("Starting low-priority kernel worker thread\n"); + + g_work[LPWORK].pid = KERNEL_THREAD(LPWORKNAME, CONFIG_SCHED_LPWORKPRIORITY, CONFIG_SCHED_LPWORKSTACKSIZE, (main_t)work_lpthread, (FAR char * const *)NULL); ASSERT(g_work[LPWORK].pid > 0); -#endif -#endif + +#endif /* CONFIG_SCHED_LPWORK */ +#endif /* CONFIG_SCHED_HPWORK */ +#endif /* CONFIG_SCHED_WORKQUEUE */ /* Once the operating system has been initialized, the system must be * started by spawning the user init thread of execution. This is the |