Mention support for AMD/znver5 in GAS
[binutils-gdb.git] / gdbsupport / event-pipe.h
blobfb5dd3a8833c00f30d48dc656ed64eba39b4b002
1 /* Event pipe for GDB, the GNU debugger.
3 Copyright (C) 2021-2024 Free Software Foundation, Inc.
5 This file is part of GDB.
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 3 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, see <http://www.gnu.org/licenses/>. */
20 #ifndef COMMON_EVENT_PIPE_H
21 #define COMMON_EVENT_PIPE_H
23 /* An event pipe used as a waitable file in the event loop in place of
24 some other event associated with a signal. The handler for the
25 signal marks the event pipe to force a wakeup in the event loop.
26 This uses the well-known self-pipe trick. */
28 class event_pipe
30 public:
31 event_pipe() = default;
32 ~event_pipe();
34 DISABLE_COPY_AND_ASSIGN (event_pipe);
36 /* Create a new pipe. */
37 bool open_pipe ();
39 /* Close the pipe. */
40 void close_pipe ();
42 /* True if the event pipe has been opened. */
43 bool is_open () const
44 { return m_fds[0] != -1; }
46 /* The file descriptor of the waitable file to use in the event
47 loop. */
48 int event_fd () const
49 { return m_fds[0]; }
51 /* Flush the event pipe. */
52 void flush ();
54 /* Put something in the pipe, so the event loop wakes up. */
55 void mark ();
56 private:
57 int m_fds[2] = { -1, -1 };
60 #endif /* COMMON_EVENT_PIPE_H */