poll.h 701 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2016-09-19 Heyuanjie The first version.
  9. * 2016-12-26 Bernard Update poll interface
  10. */
  11. #ifndef IPC_POLL_H__
  12. #define IPC_POLL_H__
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. struct rt_pollreq;
  17. typedef void (*poll_queue_proc)(rt_wqueue_t *, struct rt_pollreq *);
  18. typedef struct rt_pollreq
  19. {
  20. poll_queue_proc _proc;
  21. short _key;
  22. } rt_pollreq_t;
  23. rt_inline void rt_poll_add(rt_wqueue_t *wq, rt_pollreq_t *req)
  24. {
  25. if (req && req->_proc && wq)
  26. {
  27. req->_proc(wq, req);
  28. }
  29. }
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. #endif