1 /* gdbsched.h -- event scheduling facitilies
3 Copyright 2001, 2002 Red Hat, Inc.
5 This file is part of RDA, the Red Hat Debug Agent (and library).
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.
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.
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.
22 Alternative licenses for RDA may be arranged by contacting Red Hat,
32 struct gdbserv_target;
34 struct gdbserv_thread;
36 /* Simple minded event scheduler. */
38 /* Handle for a scheduled event. Use this when removing scheduled
43 /* Ftype for handling events. To make life easier (?) the handler
44 takes a GDBSERV and a THREAD as well as a context. */
46 typedef void gdbsched_handler_ftype (struct gdbserv *gdbserv,
47 struct gdbserv_thread *thread,
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
55 struct gdbsched *gdbsched_schedule (long time,
56 gdbsched_handler_ftype *sched,
57 struct gdbserv *gdbserv,
58 struct gdbserv_thread *thread,
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. */
66 void gdbsched_deschedule (struct gdbsched *sched,
68 gdbsched_handler_ftype **handler,
69 struct gdbserv **gdbserv,
70 struct gdbserv_thread **thread,
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
79 long gdbsched_dispatch (long time);