summaryrefslogtreecommitdiff
path: root/nuttx/sched
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-10-10 13:21:37 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-10-10 13:21:37 -0600
commitf1ce005747fef1426ddc6a6564e78429afd66455 (patch)
treee34baca7321f77a62ab78e42f319ff8fc5fc594c /nuttx/sched
parent7861ae6281ce92c2dde2909f78474f1d98393205 (diff)
downloadnuttx-f1ce005747fef1426ddc6a6564e78429afd66455.tar.gz
nuttx-f1ce005747fef1426ddc6a6564e78429afd66455.tar.bz2
nuttx-f1ce005747fef1426ddc6a6564e78429afd66455.zip
Add support for delays of different durations in work queue processing
Diffstat (limited to 'nuttx/sched')
-rw-r--r--nuttx/sched/wqueue/kwork_hpthread.c16
-rw-r--r--nuttx/sched/wqueue/kwork_inherit.c4
-rw-r--r--nuttx/sched/wqueue/kwork_lpthread.c16
-rw-r--r--nuttx/sched/wqueue/kwork_signal.c4
4 files changed, 22 insertions, 18 deletions
diff --git a/nuttx/sched/wqueue/kwork_hpthread.c b/nuttx/sched/wqueue/kwork_hpthread.c
index 8745fbfb0..5457452d3 100644
--- a/nuttx/sched/wqueue/kwork_hpthread.c
+++ b/nuttx/sched/wqueue/kwork_hpthread.c
@@ -46,6 +46,7 @@
#include <nuttx/wqueue.h>
#include <nuttx/kthread.h>
#include <nuttx/kmalloc.h>
+#include <nuttx/clock.h>
#include "wqueue/wqueue.h"
@@ -151,19 +152,20 @@ int work_hpstart(void)
{
/* Initialize work queue data structures */
+ g_hpwork.delay = CONFIG_SCHED_WORKPERIOD / USEC_PER_TICK;
dq_init(&g_hpwork.q);
/* Start the high-priority, kernel mode worker thread */
svdbg("Starting high-priority kernel worker thread\n");
- g_hpwork.pid = kernel_thread(HPWORKNAME, CONFIG_SCHED_WORKPRIORITY,
- CONFIG_SCHED_WORKSTACKSIZE,
- (main_t)work_hpthread,
- (FAR char * const *)NULL);
+ g_hpwork.pid[0] = kernel_thread(HPWORKNAME, CONFIG_SCHED_WORKPRIORITY,
+ CONFIG_SCHED_WORKSTACKSIZE,
+ (main_t)work_hpthread,
+ (FAR char * const *)NULL);
- DEBUGASSERT(g_hpwork.pid > 0);
- if (g_hpwork.pid < 0)
+ DEBUGASSERT(g_hpwork.pid[0] > 0);
+ if (g_hpwork.pid[0] < 0)
{
int errcode = errno;
DEBUGASSERT(errcode > 0);
@@ -172,7 +174,7 @@ int work_hpstart(void)
return -errcode;
}
- return g_hpwork.pid;
+ return g_hpwork.pid[0];
}
#endif /* CONFIG_SCHED_WORKQUEUE && CONFIG_SCHED_HPWORK*/
diff --git a/nuttx/sched/wqueue/kwork_inherit.c b/nuttx/sched/wqueue/kwork_inherit.c
index ad71b1ba3..af2698f5d 100644
--- a/nuttx/sched/wqueue/kwork_inherit.c
+++ b/nuttx/sched/wqueue/kwork_inherit.c
@@ -91,7 +91,7 @@ void lpwork_boostpriority(uint8_t reqprio)
* thread from the process ID.
*/
- wpid = g_lpwork.pid;
+ wpid = g_lpwork.pid[0];
wtcb = sched_gettcb(wpid);
/* Prevent context switches until we get the priorities right */
@@ -214,7 +214,7 @@ void lpwork_restorepriority(uint8_t reqprio)
* thread from the process ID.
*/
- wpid = g_lpwork.pid;
+ wpid = g_lpwork.pid[0];
wtcb = sched_gettcb(wpid);
/* Prevent context switches until we get the priorities right */
diff --git a/nuttx/sched/wqueue/kwork_lpthread.c b/nuttx/sched/wqueue/kwork_lpthread.c
index b0e39f26a..30e4eb50a 100644
--- a/nuttx/sched/wqueue/kwork_lpthread.c
+++ b/nuttx/sched/wqueue/kwork_lpthread.c
@@ -46,6 +46,7 @@
#include <nuttx/wqueue.h>
#include <nuttx/kthread.h>
#include <nuttx/kmalloc.h>
+#include <nuttx/clock.h>
#include "wqueue/wqueue.h"
@@ -148,19 +149,20 @@ int work_lpstart(void)
{
/* Initialize work queue data structures */
+ g_lpwork.delay = CONFIG_SCHED_LPWORKPERIOD / USEC_PER_TICK;
dq_init(&g_lpwork.q);
/* Start the low-priority, kernel mode worker thread(s) */
svdbg("Starting low-priority kernel worker thread\n");
- g_lpwork.pid = kernel_thread(LPWORKNAME, CONFIG_SCHED_LPWORKPRIORITY,
- CONFIG_SCHED_LPWORKSTACKSIZE,
- (main_t)work_lpthread,
- (FAR char * const *)NULL);
+ g_lpwork.pid[0] = kernel_thread(LPWORKNAME, CONFIG_SCHED_LPWORKPRIORITY,
+ CONFIG_SCHED_LPWORKSTACKSIZE,
+ (main_t)work_lpthread,
+ (FAR char * const *)NULL);
- DEBUGASSERT(g_lpwork.pid > 0);
- if (g_lpwork.pid < 0)
+ DEBUGASSERT(g_lpwork.pid[0] > 0);
+ if (g_lpwork.pid[0] < 0)
{
int errcode = errno;
DEBUGASSERT(errcode > 0);
@@ -169,7 +171,7 @@ int work_lpstart(void)
return -errcode;
}
- return g_lpwork.pid;
+ return g_lpwork.pid[0];
}
#endif /* CONFIG_SCHED_WORKQUEUE && CONFIG_SCHED_LPWORK */
diff --git a/nuttx/sched/wqueue/kwork_signal.c b/nuttx/sched/wqueue/kwork_signal.c
index 1f99af7b5..03253eff3 100644
--- a/nuttx/sched/wqueue/kwork_signal.c
+++ b/nuttx/sched/wqueue/kwork_signal.c
@@ -97,14 +97,14 @@ int work_signal(int qid)
#ifdef CONFIG_SCHED_HPWORK
if (qid == HPWORK)
{
- pid = g_hpwork.pid;
+ pid = g_hpwork.pid[0];
}
else
#endif
#ifdef CONFIG_SCHED_LPWORK
if (qid == LPWORK)
{
- pid = g_lpwork.pid;
+ pid = g_lpwork.pid[0];
}
else
#endif