]> git.sesse.net Git - bcachefs-tools-debian/blob - include/linux/completion.h
rust: bump rpassword to v7.x
[bcachefs-tools-debian] / include / linux / completion.h
1 #ifndef __LINUX_COMPLETION_H
2 #define __LINUX_COMPLETION_H
3
4 /*
5  * (C) Copyright 2001 Linus Torvalds
6  *
7  * Atomic wait-for-completion handler data structures.
8  * See kernel/sched/completion.c for details.
9  */
10
11 #include <linux/wait.h>
12
13 struct completion {
14         unsigned int done;
15         wait_queue_head_t wait;
16 };
17
18 #define DECLARE_COMPLETION(work)                                        \
19         struct completion work = {                                      \
20                 .done = 0,                                              \
21                 .wait = __WAIT_QUEUE_HEAD_INITIALIZER((work).wait)      \
22         }
23
24 #define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
25
26 static inline void init_completion(struct completion *x)
27 {
28         x->done = 0;
29         init_waitqueue_head(&x->wait);
30 }
31
32 static inline void reinit_completion(struct completion *x)
33 {
34         x->done = 0;
35 }
36
37 void complete(struct completion *);
38 void wait_for_completion(struct completion *);
39
40 #define wait_for_completion_interruptible(x) (wait_for_completion(x), 0)
41
42 #endif