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 2 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, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 */ 20 21 22 #ifndef _EVENTS_H_ 23 #define _EVENTS_H_ 24 25 /* typedef struct _event_queue event_queue; */ 26 /* typedef struct _event_entry_tag *event_entry_tag; */ 27 28 typedef void event_handler(void *data); 29 30 INLINE_EVENTS\ 31 (event_queue *) event_queue_create 32 (void); 33 34 INLINE_EVENTS\ 35 (void) event_queue_init 36 (event_queue *queue); 37 38 39 /* (de)Schedule things to happen in the future. */ 40 41 INLINE_EVENTS\ 42 (event_entry_tag) event_queue_schedule 43 (event_queue *queue, 44 signed64 delta_time, 45 event_handler *handler, 46 void *data); 47 48 INLINE_EVENTS\ 49 (event_entry_tag) event_queue_schedule_after_signal 50 (event_queue *queue, 51 signed64 delta_time, 52 event_handler *handler, 53 void *data); 54 55 INLINE_EVENTS\ 56 (void) event_queue_deschedule 57 (event_queue *queue, 58 event_entry_tag event_to_remove); 59 60 61 /* progress time. In to parts so that if something is pending, the 62 caller has a chance to save any cached state */ 63 64 INLINE_EVENTS\ 65 (int) event_queue_tick 66 (event_queue *queue); 67 68 INLINE_EVENTS\ 69 (void) event_queue_process 70 (event_queue *events); 71 72 73 /* local concept of time */ 74 75 INLINE_EVENTS\ 76 (signed64) event_queue_time 77 (event_queue *queue); 78 79 #endif /* _EVENTS_H_ */ 80