summaryrefslogtreecommitdiff
path: root/nuttx/libc
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-10-12 09:40:26 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-10-12 09:40:26 -0600
commita588411f698ae86c83e27974ad5c26357b9238bb (patch)
tree15304ae9e261678166a0ac07155bd7e07788d3a1 /nuttx/libc
parent5866c68c6c526772beaf5e0b0e32cd145b9b4709 (diff)
downloadnuttx-a588411f698ae86c83e27974ad5c26357b9238bb.tar.gz
nuttx-a588411f698ae86c83e27974ad5c26357b9238bb.tar.bz2
nuttx-a588411f698ae86c83e27974ad5c26357b9238bb.zip
Fix error in protected build, user-mode work queue
Diffstat (limited to 'nuttx/libc')
-rw-r--r--nuttx/libc/wqueue/work_usrthread.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/nuttx/libc/wqueue/work_usrthread.c b/nuttx/libc/wqueue/work_usrthread.c
index 39f5951c2..f55aaa2f8 100644
--- a/nuttx/libc/wqueue/work_usrthread.c
+++ b/nuttx/libc/wqueue/work_usrthread.c
@@ -154,8 +154,6 @@ void work_process(FAR struct usr_wqueue_s *wqueue)
work = (FAR struct work_s *)wqueue->q.head;
while (work)
{
- DEBUGASSERT(wqueue->wq_sem.count > 0);
-
/* Is this work ready? It is ready if there is no delay or if
* the delay has elapsed. qtime is the time that the work was added
* to the work queue. It will always be greater than or equal to
@@ -210,7 +208,7 @@ void work_process(FAR struct usr_wqueue_s *wqueue)
return;
}
- work = (FAR struct work_s *)wqueue->q.head;
+ work = (FAR struct work_s *)wqueue->q.head;
}
else
{
@@ -248,8 +246,8 @@ void work_process(FAR struct usr_wqueue_s *wqueue)
/* Get the delay (in clock ticks) since we started the sampling */
- elapsed = clock_systimer() - work->qtime;
- if (elapsed <= wqueue->delay)
+ elapsed = clock_systimer() - stick;
+ if (elapsed < wqueue->delay && next > 0)
{
/* How must time would we need to delay to get to the end of the
* sampling period? The amount of time we delay should be the smaller
@@ -259,15 +257,13 @@ void work_process(FAR struct usr_wqueue_s *wqueue)
remaining = wqueue->delay - elapsed;
next = MIN(next, remaining);
- if (next > 0)
- {
- /* Wait awhile to check the work list. We will wait here until
- * either the time elapses or until we are awakened by a signal.
- * Interrupts will be re-enabled while we wait.
- */
- usleep(next * USEC_PER_TICK);
- }
+ /* Wait awhile to check the work list. We will wait here until
+ * either the time elapses or until we are awakened by a signal.
+ * Interrupts will be re-enabled while we wait.
+ */
+
+ usleep(next * USEC_PER_TICK);
}
work_unlock();