summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2015-04-14 15:54:34 +0200
committerLorenz Meier <lm@inf.ethz.ch>2015-04-14 15:54:34 +0200
commit8cad2dc90548b3a5f0218b55df80c641fd777e7c (patch)
tree02fb7682eea9b70043440e74ce970bc423fa7a5a
parent94818ce16f63c4728a1d9316628a3651287f16df (diff)
downloadpx4-nuttx-wqueue_yield.tar.gz
px4-nuttx-wqueue_yield.tar.bz2
px4-nuttx-wqueue_yield.zip
Work queue: Yield between queue items to ensure queue execution stays in lockstep with main OS tasks scheduling on priorities.wqueue_yield
-rw-r--r--nuttx/libc/wqueue/work_thread.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/nuttx/libc/wqueue/work_thread.c b/nuttx/libc/wqueue/work_thread.c
index 6ef8a874b..2b8f52d44 100644
--- a/nuttx/libc/wqueue/work_thread.c
+++ b/nuttx/libc/wqueue/work_thread.c
@@ -161,6 +161,13 @@ static void work_process(FAR struct wqueue_s *wqueue)
irqrestore(flags);
worker(arg);
+ /* Yield scheduling once - we need this as the work queue items will else
+ * always execute before tasks which have become ready to run in the meantime.
+ * If no same or higher priority task is ready this will have no effect, if a
+ * task is ready we will return here after it executed.
+ */
+ sched_yield();
+
/* Now, unfortunately, since we re-enabled interrupts we don't
* know the state of the work list and we will have to start
* back at the head of the list.