source: trunk/packages/xen-3.1/xen-3.1/xen/include/asm-ia64/linux/completion.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 1.5 KB
Line 
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.c for details.
9 */
10
11#include <linux/wait.h>
12
13struct completion {
14        unsigned int done;
15        wait_queue_head_t wait;
16};
17
18#define COMPLETION_INITIALIZER(work) \
19        { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
20
21#define COMPLETION_INITIALIZER_ONSTACK(work) \
22        ({ init_completion(&work); work; })
23
24#define DECLARE_COMPLETION(work) \
25        struct completion work = COMPLETION_INITIALIZER(work)
26
27/*
28 * Lockdep needs to run a non-constant initializer for on-stack
29 * completions - so we use the _ONSTACK() variant for those that
30 * are on the kernel stack:
31 */
32#ifdef CONFIG_LOCKDEP
33# define DECLARE_COMPLETION_ONSTACK(work) \
34        struct completion work = COMPLETION_INITIALIZER_ONSTACK(work)
35#else
36# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
37#endif
38
39static inline void init_completion(struct completion *x)
40{
41        x->done = 0;
42        init_waitqueue_head(&x->wait);
43}
44
45extern void FASTCALL(wait_for_completion(struct completion *));
46extern int FASTCALL(wait_for_completion_interruptible(struct completion *x));
47extern unsigned long FASTCALL(wait_for_completion_timeout(struct completion *x,
48                                                   unsigned long timeout));
49extern unsigned long FASTCALL(wait_for_completion_interruptible_timeout(
50                        struct completion *x, unsigned long timeout));
51
52extern void FASTCALL(complete(struct completion *));
53extern void FASTCALL(complete_all(struct completion *));
54
55#define INIT_COMPLETION(x)      ((x).done = 0)
56
57#endif
Note: See TracBrowser for help on using the repository browser.