Commit | Line | Data |
---|---|---|
93b54c8e | 1 | /* Async events for the GDB event loop. |
f7e23710 | 2 | Copyright (C) 1999-2020 Free Software Foundation, Inc. |
93b54c8e TT |
3 | |
4 | This file is part of GDB. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 3 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
18 | ||
19 | #ifndef ASYNC_EVENT_H | |
20 | #define ASYNC_EVENT_H | |
21 | ||
400b5eca | 22 | #include "gdbsupport/event-loop.h" |
93b54c8e TT |
23 | |
24 | struct async_signal_handler; | |
25 | struct async_event_handler; | |
26 | typedef void (sig_handler_func) (gdb_client_data); | |
27 | typedef void (async_event_handler_func) (gdb_client_data); | |
28 | ||
29 | extern struct async_signal_handler * | |
db20ebdf SM |
30 | create_async_signal_handler (sig_handler_func *proc, |
31 | gdb_client_data client_data, | |
32 | const char *name); | |
93b54c8e TT |
33 | extern void delete_async_signal_handler (struct async_signal_handler **); |
34 | ||
35 | /* Call the handler from HANDLER the next time through the event | |
36 | loop. */ | |
37 | extern void mark_async_signal_handler (struct async_signal_handler *handler); | |
38 | ||
39 | /* Returns true if HANDLER is marked ready. */ | |
40 | ||
41 | extern int | |
42 | async_signal_handler_is_marked (struct async_signal_handler *handler); | |
43 | ||
44 | /* Mark HANDLER as NOT ready. */ | |
45 | ||
46 | extern void clear_async_signal_handler (struct async_signal_handler *handler); | |
47 | ||
48 | /* Create and register an asynchronous event source in the event loop, | |
49 | and set PROC as its callback. CLIENT_DATA is passed as argument to | |
50 | PROC upon its invocation. Returns a pointer to an opaque structure | |
51 | used to mark as ready and to later delete this event source from | |
db20ebdf SM |
52 | the event loop. |
53 | ||
54 | NAME is a user-friendly name for the handler, used in debug statements. The | |
55 | name is not copied: its lifetime should be at least as long as that of the | |
56 | handler. */ | |
57 | ||
93b54c8e TT |
58 | extern struct async_event_handler * |
59 | create_async_event_handler (async_event_handler_func *proc, | |
db20ebdf SM |
60 | gdb_client_data client_data, |
61 | const char *name); | |
93b54c8e TT |
62 | |
63 | /* Remove the event source pointed by HANDLER_PTR created by | |
64 | CREATE_ASYNC_EVENT_HANDLER from the event loop, and release it. */ | |
65 | extern void | |
66 | delete_async_event_handler (struct async_event_handler **handler_ptr); | |
67 | ||
68 | /* Call the handler from HANDLER the next time through the event | |
69 | loop. */ | |
70 | extern void mark_async_event_handler (struct async_event_handler *handler); | |
71 | ||
72 | /* Mark the handler (ASYNC_HANDLER_PTR) as NOT ready. */ | |
73 | ||
74 | extern void clear_async_event_handler (struct async_event_handler *handler); | |
75 | ||
76 | extern void initialize_async_signal_handlers (void); | |
77 | ||
78 | #endif /* ASYNC_EVENT_H */ |