[Devel] [PATCH 1/2] new helper: wait_event_killable_exclusive()
Stanislav Kinsburskiy
skinsbursky at virtuozzo.com
Thu Oct 13 03:03:40 PDT 2016
Backport of 6a0fb306738994d6f091791aeb11a5dc87ad8f4c.
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at 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 { \
More information about the Devel
mailing list