completion.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef __LINUX_COMPLETION_H
  2. #define __LINUX_COMPLETION_H
  3. /*
  4.  * (C) Copyright 2001 Linus Torvalds
  5.  *
  6.  * Atomic wait-for-completion handler data structures.
  7.  * See kernel/sched.c for details.
  8.  */
  9. #include <linux/wait.h>
  10. struct completion {
  11. unsigned int done;
  12. wait_queue_head_t wait;
  13. };
  14. #define COMPLETION_INITIALIZER(work) 
  15. { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
  16. #define DECLARE_COMPLETION(work) 
  17. struct completion work = COMPLETION_INITIALIZER(work)
  18. static inline void init_completion(struct completion *x)
  19. {
  20. x->done = 0;
  21. init_waitqueue_head(&x->wait);
  22. }
  23. extern void FASTCALL(wait_for_completion(struct completion *));
  24. extern void FASTCALL(complete(struct completion *));
  25. #define INIT_COMPLETION(x) ((x).done = 0)
  26. #endif