Linux v2.6.15-rc7
[pohmelfs.git] / include / linux / completion.h
blob90663ad217f983635231dc3550d7ac1fc8b18bee
1 #ifndef __LINUX_COMPLETION_H
2 #define __LINUX_COMPLETION_H
4 /*
5 * (C) Copyright 2001 Linus Torvalds
7 * Atomic wait-for-completion handler data structures.
8 * See kernel/sched.c for details.
9 */
11 #include <linux/wait.h>
13 struct completion {
14 unsigned int done;
15 wait_queue_head_t wait;
18 #define COMPLETION_INITIALIZER(work) \
19 { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
21 #define DECLARE_COMPLETION(work) \
22 struct completion work = COMPLETION_INITIALIZER(work)
24 static inline void init_completion(struct completion *x)
26 x->done = 0;
27 init_waitqueue_head(&x->wait);
30 extern void FASTCALL(wait_for_completion(struct completion *));
31 extern int FASTCALL(wait_for_completion_interruptible(struct completion *x));
32 extern unsigned long FASTCALL(wait_for_completion_timeout(struct completion *x,
33 unsigned long timeout));
34 extern unsigned long FASTCALL(wait_for_completion_interruptible_timeout(
35 struct completion *x, unsigned long timeout));
37 extern void FASTCALL(complete(struct completion *));
38 extern void FASTCALL(complete_all(struct completion *));
40 #define INIT_COMPLETION(x) ((x).done = 0)
42 #endif