[615] | 1 | #ifndef _LINUX_COMPLETION_H
|
---|
| 2 | #define _LINUX_COMPLETION_H
|
---|
| 3 |
|
---|
| 4 | #include <linux/wait.h>
|
---|
[646] | 5 |
|
---|
[615] | 6 | /*
|
---|
| 7 | * struct completion - structure used to maintain state for a "completion"
|
---|
| 8 | *
|
---|
| 9 | * This is the opaque structure used to maintain the state for a "completion".
|
---|
| 10 | * Completions currently use a FIFO to queue threads that have to wait for
|
---|
| 11 | * the "completion" event.
|
---|
| 12 | *
|
---|
| 13 | * See also: complete(), wait_for_completion() (and friends _timeout,
|
---|
| 14 | * _interruptible, _interruptible_timeout, and _killable), init_completion(),
|
---|
| 15 | * reinit_completion(), and macros DECLARE_COMPLETION(),
|
---|
| 16 | * DECLARE_COMPLETION_ONSTACK().
|
---|
| 17 | */
|
---|
| 18 | struct completion {
|
---|
| 19 | unsigned int done;
|
---|
| 20 | wait_queue_head_t wait;
|
---|
| 21 | };
|
---|
| 22 |
|
---|
[629] | 23 | #define DECLARE_COMPLETION_ONSTACK(work) struct completion work;
|
---|
[615] | 24 | /**
|
---|
| 25 | * init_completion - Initialize a dynamically allocated completion
|
---|
| 26 | * @x: completion structure that is to be initialized
|
---|
| 27 | *
|
---|
| 28 | * This inline function will initialize a dynamically created completion
|
---|
| 29 | * structure.
|
---|
| 30 | */
|
---|
| 31 | static inline void init_completion(struct completion *x)
|
---|
| 32 | {
|
---|
| 33 | x->done = 0;
|
---|
| 34 | init_waitqueue_head(&x->wait);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | extern void complete(struct completion *);
|
---|
[625] | 38 | extern void complete_all(struct completion *);
|
---|
| 39 | extern void wait_for_completion(struct completion *x);
|
---|
| 40 | extern bool try_wait_for_completion(struct completion *x);
|
---|
[615] | 41 | #endif /* _LINUX_COMPLETION_H */
|
---|