fdset.h 528 B

12345678910111213141516171819202122232425262728
  1. #ifndef FDSET_H
  2. #define FDSET_H
  3. #include "dllist.h"
  4. struct fdset
  5. {
  6. struct dl_head list[1];
  7. int del_count;
  8. };
  9. struct fdset_node /*internal*/
  10. {
  11. struct dl_node node[1];
  12. int fd;
  13. void (*handler)(void *data, int fd);
  14. void *data;
  15. };
  16. extern struct fdset fds[1]; /* global fd list */
  17. int fdset_init(struct fdset *fds);
  18. int fdset_add_fd(struct fdset *fds, int fd, void *handler, void *data);
  19. int fdset_del_fd(struct fdset *fds, int fd);
  20. int fdset_select(struct fdset *fds, int timeout /*millisec*/);
  21. #endif