2 * Copyright © 2013 Canonical Ltd.
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
19 #ifndef CORE_POSIX_SIGNALABLE_H_
20 #define CORE_POSIX_SIGNALABLE_H_
22 #include <core/posix/signal.h>
23 #include <core/posix/visibility.h>
26 #include <system_error>
33 * @brief The Signalable class abstracts the ability of an entity to be delivered a posix signal.
35 class CORE_POSIX_DLL_PUBLIC Signalable
38 virtual ~Signalable() { }
41 * @brief Sends a signal to this signalable object.
42 * @throws std::system_error in case of problems.
43 * @param [in] signal The signal to be sent to the process.
45 virtual void send_signal_or_throw(Signal signal);
48 * @brief Sends a signal to this signalable object.
49 * @param [in] signal The signal to be sent to the process.
50 * @param [out] e Set to contain an error if an issue arises.
52 virtual void send_signal(Signal signal, std::error_code& e) noexcept(true);
55 CORE_POSIX_DLL_LOCAL explicit Signalable(pid_t pid);
58 struct CORE_POSIX_DLL_LOCAL Private;
59 std::shared_ptr<Private> d;
64 #endif // CORE_POSIX_SIGNALABLE_H_