1 /* Event pipe for GDB, the GNU debugger.
3 Copyright (C) 2021-2023 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. */
31 event_pipe() = default;
34 DISABLE_COPY_AND_ASSIGN (event_pipe
);
36 /* Create a new pipe. */
42 /* True if the event pipe has been opened. */
44 { return m_fds
[0] != -1; }
46 /* The file descriptor of the waitable file to use in the event
51 /* Flush the event pipe. */
54 /* Put something in the pipe, so the event loop wakes up. */
57 int m_fds
[2] = { -1, -1 };
60 #endif /* COMMON_EVENT_PIPE_H */