diff options
| author | Sergey Senozhatsky <senozhatsky@chromium.org> | 2025-06-10 13:52:28 +0900 |
|---|---|---|
| committer | Miklos Szeredi <mszeredi@redhat.com> | 2025-08-27 14:29:43 +0200 |
| commit | dd6a5a71c811289eec234e78cb9ca34d055d2ad5 (patch) | |
| tree | f326c25b9953be37542930c8f1634d9860f86d58 /include/linux/wait.h | |
| parent | 6be0ddb20200c0e45c1e7db4b817fccd04d53f2d (diff) | |
sched/wait: Add wait_event_state_exclusive()
Allows exclusive waits with a custom @state.
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'include/linux/wait.h')
| -rw-r--r-- | include/linux/wait.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h index 09855d819418..f648044466d5 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -965,6 +965,18 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *); __ret; \ }) +#define __wait_event_state_exclusive(wq, condition, state) \ + ___wait_event(wq, condition, state, 1, 0, schedule()) + +#define wait_event_state_exclusive(wq, condition, state) \ +({ \ + int __ret = 0; \ + might_sleep(); \ + if (!(condition)) \ + __ret = __wait_event_state_exclusive(wq, condition, state); \ + __ret; \ +}) + #define __wait_event_killable_timeout(wq_head, condition, timeout) \ ___wait_event(wq_head, ___wait_cond_timeout(condition), \ TASK_KILLABLE, 0, timeout, \ |
