Automatic date update in version.in
[deliverable/binutils-gdb.git] / gdb / async-event.h
1 /* Async events for the GDB event loop.
2 Copyright (C) 1999-2021 Free Software Foundation, Inc.
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
22 #include "gdbsupport/event-loop.h"
23
24 struct async_signal_handler;
25 struct async_event_handler;
26 typedef void (sig_handler_func) (gdb_client_data);
27
28 /* Type of async event handler callbacks.
29
30 DATA is the client data originally passed to create_async_event_handler.
31
32 The callback is called when the async event handler is marked. The callback
33 is responsible for clearing the async event handler if it no longer needs
34 to be called. */
35
36 typedef void (async_event_handler_func) (gdb_client_data);
37
38 extern struct async_signal_handler *
39 create_async_signal_handler (sig_handler_func *proc,
40 gdb_client_data client_data,
41 const char *name);
42 extern void delete_async_signal_handler (struct async_signal_handler **);
43
44 /* Call the handler from HANDLER the next time through the event
45 loop. */
46 extern void mark_async_signal_handler (struct async_signal_handler *handler);
47
48 /* Returns true if HANDLER is marked ready. */
49
50 extern int
51 async_signal_handler_is_marked (struct async_signal_handler *handler);
52
53 /* Mark HANDLER as NOT ready. */
54
55 extern void clear_async_signal_handler (struct async_signal_handler *handler);
56
57 /* Create and register an asynchronous event source in the event loop,
58 and set PROC as its callback. CLIENT_DATA is passed as argument to
59 PROC upon its invocation. Returns a pointer to an opaque structure
60 used to mark as ready and to later delete this event source from
61 the event loop.
62
63 NAME is a user-friendly name for the handler, used in debug statements. The
64 name is not copied: its lifetime should be at least as long as that of the
65 handler. */
66
67 extern struct async_event_handler *
68 create_async_event_handler (async_event_handler_func *proc,
69 gdb_client_data client_data,
70 const char *name);
71
72 /* Remove the event source pointed by HANDLER_PTR created by
73 CREATE_ASYNC_EVENT_HANDLER from the event loop, and release it. */
74 extern void
75 delete_async_event_handler (struct async_event_handler **handler_ptr);
76
77 /* Call the handler from HANDLER the next time through the event
78 loop. */
79 extern void mark_async_event_handler (struct async_event_handler *handler);
80
81 /* Return true if HANDLER is marked. */
82 extern bool async_event_handler_marked (async_event_handler *handler);
83
84 /* Mark the handler (ASYNC_HANDLER_PTR) as NOT ready. */
85
86 extern void clear_async_event_handler (struct async_event_handler *handler);
87
88 extern void initialize_async_signal_handlers (void);
89
90 #endif /* ASYNC_EVENT_H */
This page took 0.030228 seconds and 4 git commands to generate.