summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/closure.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/closure.h b/include/linux/closure.h
index 261d06729013..d6a4f454396d 100644
--- a/include/linux/closure.h
+++ b/include/linux/closure.h
@@ -378,4 +378,26 @@ static inline void closure_call(struct closure *cl, closure_fn fn,
continue_at_nobarrier(cl, fn, wq);
}
+#define __closure_wait_event(waitlist, _cond) \
+do { \
+ struct closure cl; \
+ \
+ closure_init_stack(&cl); \
+ \
+ while (1) { \
+ closure_wait(waitlist, &cl); \
+ if (_cond) \
+ break; \
+ closure_sync(&cl); \
+ } \
+ closure_wake_up(waitlist); \
+ closure_sync(&cl); \
+} while (0)
+
+#define closure_wait_event(waitlist, _cond) \
+do { \
+ if (!(_cond)) \
+ __closure_wait_event(waitlist, _cond); \
+} while (0)
+
#endif /* _LINUX_CLOSURE_H */