diff options
Diffstat (limited to 'include/linux/completion.h')
| -rw-r--r-- | include/linux/completion.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/include/linux/completion.h b/include/linux/completion.h index 3cd574d5b19e..5d5aaae3af43 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * (C) Copyright 2001 Linus Torvalds | 5 | * (C) Copyright 2001 Linus Torvalds |
| 6 | * | 6 | * |
| 7 | * Atomic wait-for-completion handler data structures. | 7 | * Atomic wait-for-completion handler data structures. |
| 8 | * See kernel/sched/core.c for details. | 8 | * See kernel/sched/completion.c for details. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/wait.h> | 11 | #include <linux/wait.h> |
| @@ -19,8 +19,8 @@ | |||
| 19 | * | 19 | * |
| 20 | * See also: complete(), wait_for_completion() (and friends _timeout, | 20 | * See also: complete(), wait_for_completion() (and friends _timeout, |
| 21 | * _interruptible, _interruptible_timeout, and _killable), init_completion(), | 21 | * _interruptible, _interruptible_timeout, and _killable), init_completion(), |
| 22 | * and macros DECLARE_COMPLETION(), DECLARE_COMPLETION_ONSTACK(), and | 22 | * reinit_completion(), and macros DECLARE_COMPLETION(), |
| 23 | * INIT_COMPLETION(). | 23 | * DECLARE_COMPLETION_ONSTACK(). |
| 24 | */ | 24 | */ |
| 25 | struct completion { | 25 | struct completion { |
| 26 | unsigned int done; | 26 | unsigned int done; |
| @@ -65,7 +65,7 @@ struct completion { | |||
| 65 | 65 | ||
| 66 | /** | 66 | /** |
| 67 | * init_completion - Initialize a dynamically allocated completion | 67 | * init_completion - Initialize a dynamically allocated completion |
| 68 | * @x: completion structure that is to be initialized | 68 | * @x: pointer to completion structure that is to be initialized |
| 69 | * | 69 | * |
| 70 | * This inline function will initialize a dynamically created completion | 70 | * This inline function will initialize a dynamically created completion |
| 71 | * structure. | 71 | * structure. |
| @@ -76,6 +76,18 @@ static inline void init_completion(struct completion *x) | |||
| 76 | init_waitqueue_head(&x->wait); | 76 | init_waitqueue_head(&x->wait); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | /** | ||
| 80 | * reinit_completion - reinitialize a completion structure | ||
| 81 | * @x: pointer to completion structure that is to be reinitialized | ||
| 82 | * | ||
| 83 | * This inline function should be used to reinitialize a completion structure so it can | ||
| 84 | * be reused. This is especially important after complete_all() is used. | ||
| 85 | */ | ||
| 86 | static inline void reinit_completion(struct completion *x) | ||
| 87 | { | ||
| 88 | x->done = 0; | ||
| 89 | } | ||
| 90 | |||
| 79 | extern void wait_for_completion(struct completion *); | 91 | extern void wait_for_completion(struct completion *); |
| 80 | extern void wait_for_completion_io(struct completion *); | 92 | extern void wait_for_completion_io(struct completion *); |
| 81 | extern int wait_for_completion_interruptible(struct completion *x); | 93 | extern int wait_for_completion_interruptible(struct completion *x); |
| @@ -94,14 +106,4 @@ extern bool completion_done(struct completion *x); | |||
| 94 | extern void complete(struct completion *); | 106 | extern void complete(struct completion *); |
| 95 | extern void complete_all(struct completion *); | 107 | extern void complete_all(struct completion *); |
| 96 | 108 | ||
| 97 | /** | ||
| 98 | * INIT_COMPLETION - reinitialize a completion structure | ||
| 99 | * @x: completion structure to be reinitialized | ||
| 100 | * | ||
| 101 | * This macro should be used to reinitialize a completion structure so it can | ||
| 102 | * be reused. This is especially important after complete_all() is used. | ||
| 103 | */ | ||
| 104 | #define INIT_COMPLETION(x) ((x).done = 0) | ||
| 105 | |||
| 106 | |||
| 107 | #endif | 109 | #endif |
