1
0

poll.h 743 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #include <rtdef.h>
  14. #include <rtconfig.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. struct rt_pollreq;
  19. typedef void (*poll_queue_proc)(rt_wqueue_t *, struct rt_pollreq *);
  20. typedef struct rt_pollreq
  21. {
  22. poll_queue_proc _proc;
  23. short _key;
  24. } rt_pollreq_t;
  25. rt_inline void rt_poll_add(rt_wqueue_t *wq, rt_pollreq_t *req)
  26. {
  27. if (req && req->_proc && wq)
  28. {
  29. req->_proc(wq, req);
  30. }
  31. }
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35. #endif