private.h 1003 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "faux/faux.h"
  2. #include "faux/list.h"
  3. #include "faux/time.h"
  4. #include "faux/schev.h"
  5. #define FAUX_SCHEV_CLOCK_SOURCE CLOCK_MONOTONIC
  6. #define FAUX_SCHEV_CYCLES_INFINITE (-1)
  7. struct faux_ev_s {
  8. struct timespec time; // Planned time of event
  9. struct timespec interval; // Time interval for periodic event
  10. int cycles_num; // Number of cycles for periodic event
  11. faux_schev_periodic_t periodic; // Periodic flag
  12. int id; // Type of event
  13. void *data; // Arbitrary data linked to event
  14. };
  15. struct faux_schev_s {
  16. faux_list_t *list;
  17. };
  18. C_DECL_BEGIN
  19. int faux_ev_compare(const void *first, const void *second);
  20. int faux_ev_compare_id(const void *key, const void *list_item);
  21. int faux_ev_compare_data(const void *key, const void *list_item);
  22. faux_ev_t *faux_ev_new(const struct timespec *time, int ev_id, void *data);
  23. void faux_ev_free(void *ptr);
  24. int faux_ev_id(const faux_ev_t *ev);
  25. void *faux_ev_data(const faux_ev_t *ev);
  26. const struct timespec *faux_ev_time(const faux_ev_t *ev);
  27. C_DECL_END