events.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* This file is part of the program psim.
  2. Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #ifndef _EVENTS_H_
  15. #define _EVENTS_H_
  16. /* typedef struct _event_queue event_queue; */
  17. /* typedef struct _event_entry_tag *event_entry_tag; */
  18. typedef void event_handler(void *data);
  19. INLINE_EVENTS\
  20. (event_queue *) event_queue_create
  21. (void);
  22. INLINE_EVENTS\
  23. (void) event_queue_init
  24. (event_queue *queue);
  25. /* (de)Schedule things to happen in the future. */
  26. INLINE_EVENTS\
  27. (event_entry_tag) event_queue_schedule
  28. (event_queue *queue,
  29. int64_t delta_time,
  30. event_handler *handler,
  31. void *data);
  32. INLINE_EVENTS\
  33. (event_entry_tag) event_queue_schedule_after_signal
  34. (event_queue *queue,
  35. int64_t delta_time,
  36. event_handler *handler,
  37. void *data);
  38. INLINE_EVENTS\
  39. (void) event_queue_deschedule
  40. (event_queue *queue,
  41. event_entry_tag event_to_remove);
  42. /* progress time. In to parts so that if something is pending, the
  43. caller has a chance to save any cached state */
  44. INLINE_EVENTS\
  45. (int) event_queue_tick
  46. (event_queue *queue);
  47. INLINE_EVENTS\
  48. (void) event_queue_process
  49. (event_queue *events);
  50. /* local concept of time */
  51. INLINE_EVENTS\
  52. (int64_t) event_queue_time
  53. (event_queue *queue);
  54. #endif /* _EVENTS_H_ */