This source file includes following definitions.
- complete_acquire
- complete_release
- __init_completion
- reinit_completion
1
2 #ifndef __LINUX_COMPLETION_H
3 #define __LINUX_COMPLETION_H
4
5
6
7
8
9
10
11
12 #include <linux/wait.h>
13
14
15
16
17
18
19
20
21
22
23
24
25
26 struct completion {
27 unsigned int done;
28 wait_queue_head_t wait;
29 };
30
31 #define init_completion_map(x, m) __init_completion(x)
32 #define init_completion(x) __init_completion(x)
33 static inline void complete_acquire(struct completion *x) {}
34 static inline void complete_release(struct completion *x) {}
35
36 #define COMPLETION_INITIALIZER(work) \
37 { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
38
39 #define COMPLETION_INITIALIZER_ONSTACK_MAP(work, map) \
40 (*({ init_completion_map(&(work), &(map)); &(work); }))
41
42 #define COMPLETION_INITIALIZER_ONSTACK(work) \
43 (*({ init_completion(&work); &work; }))
44
45
46
47
48
49
50
51
52
53 #define DECLARE_COMPLETION(work) \
54 struct completion work = COMPLETION_INITIALIZER(work)
55
56
57
58
59
60
61
62
63
64
65
66
67
68 #ifdef CONFIG_LOCKDEP
69 # define DECLARE_COMPLETION_ONSTACK(work) \
70 struct completion work = COMPLETION_INITIALIZER_ONSTACK(work)
71 # define DECLARE_COMPLETION_ONSTACK_MAP(work, map) \
72 struct completion work = COMPLETION_INITIALIZER_ONSTACK_MAP(work, map)
73 #else
74 # define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
75 # define DECLARE_COMPLETION_ONSTACK_MAP(work, map) DECLARE_COMPLETION(work)
76 #endif
77
78
79
80
81
82
83
84
85 static inline void __init_completion(struct completion *x)
86 {
87 x->done = 0;
88 init_waitqueue_head(&x->wait);
89 }
90
91
92
93
94
95
96
97
98 static inline void reinit_completion(struct completion *x)
99 {
100 x->done = 0;
101 }
102
103 extern void wait_for_completion(struct completion *);
104 extern void wait_for_completion_io(struct completion *);
105 extern int wait_for_completion_interruptible(struct completion *x);
106 extern int wait_for_completion_killable(struct completion *x);
107 extern unsigned long wait_for_completion_timeout(struct completion *x,
108 unsigned long timeout);
109 extern unsigned long wait_for_completion_io_timeout(struct completion *x,
110 unsigned long timeout);
111 extern long wait_for_completion_interruptible_timeout(
112 struct completion *x, unsigned long timeout);
113 extern long wait_for_completion_killable_timeout(
114 struct completion *x, unsigned long timeout);
115 extern bool try_wait_for_completion(struct completion *x);
116 extern bool completion_done(struct completion *x);
117
118 extern void complete(struct completion *);
119 extern void complete_all(struct completion *);
120
121 #endif