Backport of 6a0fb306738994d6f091791aeb11a5dc87ad8f4c.

Signed-off-by: Stanislav Kinsburskiy <skinsbur...@virtuozzo.com>
---
 include/linux/wait.h |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 65da9e3..8475f2d 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -710,6 +710,32 @@ do {                                                       
                \
        __ret;                                                          \
 })
 
+#define __wait_event_killable_exclusive(wq, condition, ret)            \
+do {                                                                   \
+       DEFINE_WAIT(__wait);                                            \
+                                                                       \
+       for (;;) {                                                      \
+               prepare_to_wait_exclusive(&wq, &__wait, TASK_KILLABLE); \
+               if (condition)                                          \
+                       break;                                          \
+               if (!fatal_signal_pending(current)) {                   \
+                       schedule();                                     \
+                       continue;                                       \
+               }                                                       \
+               ret = -ERESTARTSYS;                                     \
+               break;                                                  \
+       }                                                               \
+       finish_wait(&wq, &__wait);                                      \
+} while (0)
+
+
+#define wait_event_killable_exclusive(wq, condition)                   \
+({                                                                     \
+       int __ret = 0;                                                  \
+       if (!(condition))                                               \
+               __wait_event_killable_exclusive(wq, condition, __ret);  \
+       __ret;                                                          \
+})
 
 #define __wait_event_lock_irq(wq, condition, lock, cmd)                        
\
 do {                                                                   \

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to