Module: xenomai-3
Branch: next
Commit: 21f530ad4e426efab46899a30b53251be5b83a60
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=21f530ad4e426efab46899a30b53251be5b83a60

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri May 22 21:02:05 2015 +0200

cobalt/pipe: care for spurious wakeups waiting for events

---

 include/boilerplate/setup.h |    2 +-
 kernel/cobalt/pipe.c        |   12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/boilerplate/setup.h b/include/boilerplate/setup.h
index bc8b3f6..e99a9b1 100644
--- a/include/boilerplate/setup.h
+++ b/include/boilerplate/setup.h
@@ -66,7 +66,7 @@ struct setup_descriptor {
  *
  * - The last priority level is used for the bootstrap code
  * (__bootstrap_ctor), which is guaranteed to run after any
- * setup/early code, provided such code is part of the main
+ * setup/early code, provided such bootstrap code is part of the main
  * executable.
  *
  * The guarantees on the init order don't go beyond what is stated
diff --git a/kernel/cobalt/pipe.c b/kernel/cobalt/pipe.c
index fa16378..76db672 100644
--- a/kernel/cobalt/pipe.c
+++ b/kernel/cobalt/pipe.c
@@ -126,13 +126,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