Rev 3480 | Rev 4292 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3480 | Rev 3482 | ||
---|---|---|---|
Line 25... | Line 25... | ||
25 | static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new) |
25 | static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new) |
26 | { |
26 | { |
27 | list_add(&new->task_list, &head->task_list); |
27 | list_add(&new->task_list, &head->task_list); |
28 | } |
28 | } |
Line 29... | Line 29... | ||
29 | 29 | ||
30 | 30 | /* |
|
31 | #define __wait_event(wq, condition) \ |
31 | #define __wait_event(wq, condition) \ |
32 | do { \ |
32 | do { \ |
33 | DEFINE_WAIT(__wait); \ |
33 | DEFINE_WAIT(__wait); \ |
34 | \ |
34 | \ |
Line 39... | Line 39... | ||
39 | schedule(); \ |
39 | schedule(); \ |
40 | } \ |
40 | } \ |
41 | finish_wait(&wq, &__wait); \ |
41 | finish_wait(&wq, &__wait); \ |
42 | } while (0) |
42 | } while (0) |
Line 43... | Line 43... | ||
43 | 43 | ||
Line 44... | Line 44... | ||
44 | 44 | */ |
|
45 | 45 | ||
46 | #define wait_event_timeout(wq, condition, timeout) \ |
46 | #define wait_event_timeout(wq, condition, timeout) \ |
47 | ({ \ |
47 | ({ \ |
Line 131... | Line 131... | ||
131 | spin_lock_init(&q->lock); |
131 | spin_lock_init(&q->lock); |
132 | INIT_LIST_HEAD(&q->task_list); |
132 | INIT_LIST_HEAD(&q->task_list); |
133 | }; |
133 | }; |
Line 134... | Line -... | ||
134 | - | ||
135 | - | ||
136 | /* |
- | |
137 | * Workqueue flags and constants. For details, please refer to |
- | |
138 | * Documentation/workqueue.txt. |
- | |
139 | */ |
- | |
140 | enum { |
- | |
141 | WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */ |
- | |
142 | WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ |
- | |
143 | WQ_FREEZABLE = 1 << 2, /* freeze during suspend */ |
- | |
144 | WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ |
- | |
145 | WQ_HIGHPRI = 1 << 4, /* high priority */ |
- | |
146 | WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ |
- | |
147 | - | ||
148 | WQ_DRAINING = 1 << 6, /* internal: workqueue is draining */ |
- | |
149 | WQ_RESCUER = 1 << 7, /* internal: workqueue has rescuer */ |
- | |
150 | - | ||
151 | WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ |
- | |
152 | WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */ |
- | |
153 | WQ_DFL_ACTIVE = WQ_MAX_ACTIVE / 2, |
- | |
154 | }; |
- | |
155 | - | ||
156 | struct work_struct; |
- | |
157 | - | ||
158 | struct workqueue_struct { |
- | |
159 | spinlock_t lock; |
- | |
160 | struct list_head worklist; |
- | |
161 | }; |
- | |
162 | - | ||
163 | typedef void (*work_func_t)(struct work_struct *work); |
- | |
164 | - | ||
165 | struct work_struct { |
- | |
166 | struct list_head entry; |
- | |
167 | struct workqueue_struct *data; |
- | |
168 | work_func_t func; |
- | |
169 | }; |
- | |
170 | - | ||
171 | struct delayed_work { |
- | |
172 | struct work_struct work; |
- | |
173 | }; |
- | |
174 | - | ||
175 | static inline struct delayed_work *to_delayed_work(struct work_struct *work) |
- | |
176 | { |
- | |
177 | return container_of(work, struct delayed_work, work); |
- | |
178 | } |
- | |
179 | - | ||
180 | - | ||
181 | - | ||
182 | struct workqueue_struct *alloc_workqueue_key(const char *fmt, |
- | |
183 | unsigned int flags, int max_active); |
- | |
184 | - | ||
185 | - | ||
186 | #define alloc_ordered_workqueue(fmt, flags, args...) \ |
- | |
187 | alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args) |
- | |
188 | - | ||
189 | int queue_delayed_work(struct workqueue_struct *wq, |
- | |
190 | struct delayed_work *dwork, unsigned long delay); |
- | |
191 | - | ||
192 | #define INIT_WORK(_work, _func) \ |
- | |
193 | do { \ |
- | |
194 | INIT_LIST_HEAD(&(_work)->entry); \ |
- | |
195 | (_work)->func = _func; \ |
- | |
196 | } while (0) |
- | |
197 | - | ||
198 | - | ||
199 | #define INIT_DELAYED_WORK(_work, _func) \ |
- | |
200 | do { \ |
- | |
201 | INIT_LIST_HEAD(&(_work)->work.entry); \ |
- | |
202 | (_work)->work.func = _func; \ |
- | |
203 | } while (0) |
- | |
204 | 134 | ||
205 | 135 | ||
206 | struct completion { |
136 | struct completion { |
207 | unsigned int done; |
137 | unsigned int done; |
Line 219... | Line 149... | ||
219 | } |
149 | } |
Line 220... | Line 150... | ||
220 | 150 | ||
Line 221... | Line -... | ||
221 | #define DEFINE_WAIT(name) DEFINE_WAIT_FUNC(name, autoremove_wake_function) |
- | |
222 | - | ||
223 | 151 | #define DEFINE_WAIT(name) DEFINE_WAIT_FUNC(name, autoremove_wake_function) |