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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri May 22 20:59:25 2015 +0200

nucleus/pipe: care for spurious wakeups waiting for events

This fixes spurious wakeups causing read() on the non-RT side to
return 0.

---

 ksrc/nucleus/pipe.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/ksrc/nucleus/pipe.c b/ksrc/nucleus/pipe.c
index 3c4dccf..df587ab 100644
--- a/ksrc/nucleus/pipe.c
+++ b/ksrc/nucleus/pipe.c
@@ -122,13 +122,17 @@ static inline void xnpipe_dequeue_all(struct xnpipe_state 
*state, int mask)
        xnpipe_enqueue_wait(__state, __mask);                           \
        xnlock_put_irqrestore(&nklock, __s);                            \
                                                                        \
-       prepare_to_wait_exclusive(__waitq, &__wait, TASK_INTERRUPTIBLE);\
-                                                                       \
-       if (!(__cond))                                                  \
+       for (;;) {                                                      \
+               __sigpending = signal_pending(current);                 \
+               if (__sigpending)                                       \
+                       break;                                          \
+               prepare_to_wait_exclusive(__waitq, &__wait, 
TASK_INTERRUPTIBLE); \
+               if (__cond)                                             \
+                       break;                                          \
                schedule();                                             \
+       }                                                               \
                                                                        \
        finish_wait(__waitq, &__wait);                                  \
-       __sigpending = signal_pending(current);                         \
                                                                        \
        /* Restore the interrupt state initially set by the caller. */  \
        xnlock_get_irqsave(&nklock, __s);                               \


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to