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