OSDN Git Service

Enable to track git://github.com/monaka/binutils.git
[pf3gnuchains/pf3gnuchains3x.git] / rda / include / gdbsched.h
1 /* gdbsched.h -- event scheduling facitilies
2  
3    Copyright 2001, 2002 Red Hat, Inc.
4
5    This file is part of RDA, the Red Hat Debug Agent (and library).
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.
21    
22    Alternative licenses for RDA may be arranged by contacting Red Hat,
23    Inc.  */
24
25 #ifdef __cplusplus
26 extern "C" {
27 #elif 0
28 }
29 #endif
30
31 struct gdbserv;
32 struct gdbserv_target;
33 struct gdblog;
34 struct gdbserv_thread;
35
36 /* Simple minded event scheduler. */
37
38 /* Handle for a scheduled event.  Use this when removing scheduled
39    events. */
40
41 struct gdbsched;
42
43 /* Ftype for handling events.  To make life easier (?) the handler
44    takes a GDBSERV and a THREAD as well as a context. */
45
46 typedef void gdbsched_handler_ftype (struct gdbserv *gdbserv,
47                                      struct gdbserv_thread *thread,
48                                      void *context);
49
50 /* Schedule an event at absolute TIME.  The TIME ``0'' is special and
51    implies that the event should be scheduled immediatly.  The unit of
52    TIME is target implementation dependant.  Typically it will be
53    seconds. */
54
55 struct gdbsched *gdbsched_schedule (long time,
56                                     gdbsched_handler_ftype *sched,
57                                     struct gdbserv *gdbserv,
58                                     struct gdbserv_thread *thread,
59                                     void *context);
60
61 /* Unschedule an event.  Pass in NULL to just unschedule the first
62    event on the queue.  Any of TIME, HANDLER, GDBSERV, THREAD and
63    CONTEXT will be assigned if non-NULL.  If there is no event, *TIME
64    is set to ``-1'' and everything else is set to NULL. */
65
66 void gdbsched_deschedule (struct gdbsched *sched,
67                           long *time,
68                           gdbsched_handler_ftype **handler,
69                           struct gdbserv **gdbserv,
70                           struct gdbserv_thread **thread,
71                           void **context);
72
73 /* Process any events scheduled on or before TIME.  Call with ``0'' to
74    process any events scheduled for immediate delivery.  Call with
75    ``-1'' to determine the time of the next event. Return the absolute
76    time of the next unprocessed event or ``-1'' if no events are
77    outstanding. */
78
79 long gdbsched_dispatch (long time);
80
81
82 #ifdef __cplusplus
83 }
84 #endif