private.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "faux/faux.h"
  2. #include "faux/list.h"
  3. #include "faux/time.h"
  4. #include "faux/sched.h"
  5. struct faux_ev_s {
  6. struct timespec time; // Planned time of event
  7. struct timespec interval; // Time interval for periodic event
  8. int cycles_num; // Number of cycles for periodic event
  9. faux_sched_periodic_t periodic; // Periodic flag
  10. int id; // Type of event
  11. void *data; // Arbitrary data linked to event
  12. };
  13. struct faux_sched_s {
  14. faux_list_t *list;
  15. };
  16. C_DECL_BEGIN
  17. int faux_ev_compare(const void *first, const void *second);
  18. int faux_ev_compare_id(const void *key, const void *list_item);
  19. int faux_ev_compare_data(const void *key, const void *list_item);
  20. faux_ev_t *faux_ev_new(const struct timespec *time, int ev_id, void *data);
  21. void faux_ev_free(void *ptr);
  22. int faux_ev_periodic(faux_ev_t *ev,
  23. const struct timespec *interval, int cycles_num);
  24. int faux_ev_dec_cycles(faux_ev_t *ev, int *new_cycles_num);
  25. int faux_ev_reschedule(faux_ev_t *ev, const struct timespec *new_time);
  26. int faux_ev_reschedule_interval(faux_ev_t *ev);
  27. int faux_ev_time_left(faux_ev_t *ev, struct timespec *left);
  28. int faux_ev_id(const faux_ev_t *ev);
  29. void *faux_ev_data(const faux_ev_t *ev);
  30. const struct timespec *faux_ev_time(const faux_ev_t *ev);
  31. faux_sched_periodic_t faux_ev_is_periodic(faux_ev_t *ev);
  32. C_DECL_END