Module: xenomai-head
Branch: master
Commit: e3c84a95c6af837175888eb659d0ebb25abd35d4
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=e3c84a95c6af837175888eb659d0ebb25abd35d4

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Sep 12 23:16:35 2009 +0200

native: be conservative in rt_queue_flush()

---

 ksrc/skins/native/queue.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ksrc/skins/native/queue.c b/ksrc/skins/native/queue.c
index 4bb44aa..963c029 100644
--- a/ksrc/skins/native/queue.c
+++ b/ksrc/skins/native/queue.c
@@ -1171,8 +1171,14 @@ int rt_queue_flush(RT_QUEUE *q)
 
        while ((h = getq(&tmpq)) != NULL) {
                msg = link2rtmsg(h);
-               /* no need to check anything - msg must be valid */
-               xnheap_test_and_free(&q->bufpool, msg, NULL);
+               /*
+                * It's a bit of a pain, but since rt_queue_delete()
+                * may run concurrently, we need to revalidate the
+                * queue descriptor for each buffer.
+                */
+               ret = rt_queue_free(q, msg + 1);
+               if (ret)
+                       break;
        }
 
        return count;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to