private.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 period; // Period for periodic event
  8. unsigned int cycle_num; // Number of cycles for periodic event
  9. faux_sched_periodic_e periodic; // Periodic flag
  10. int id; // Type of event
  11. void *data; // Arbitrary data linked to event
  12. faux_list_free_fn free_data_cb; // Callback to free user data
  13. bool_t busy;
  14. };
  15. struct faux_sched_s {
  16. faux_list_t *list;
  17. };
  18. C_DECL_BEGIN
  19. FAUX_HIDDEN int faux_ev_compare(const void *first, const void *second);
  20. FAUX_HIDDEN int faux_ev_compare_id(const void *key, const void *list_item);
  21. FAUX_HIDDEN int faux_ev_compare_data(const void *key, const void *list_item);
  22. FAUX_HIDDEN int faux_ev_compare_ptr(const void *key, const void *list_item);
  23. FAUX_HIDDEN void faux_ev_free_forced(void *ptr);
  24. FAUX_HIDDEN void faux_ev_set_busy(faux_ev_t *ev, bool_t busy);
  25. FAUX_HIDDEN bool_t faux_ev_dec_cycles(faux_ev_t *ev, unsigned int *new_cycle_num);
  26. FAUX_HIDDEN bool_t faux_ev_reschedule(faux_ev_t *ev, const struct timespec *new_time);
  27. FAUX_HIDDEN bool_t faux_ev_reschedule_period(faux_ev_t *ev);
  28. C_DECL_END