]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | // Copyright (c) 2016 Klemens D. Morgenstern |
2 | // | |
3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | #ifndef BOOST_PROCESS_DETAIL_POSIX_HANDLER_HPP_ | |
7 | #define BOOST_PROCESS_DETAIL_POSIX_HANDLER_HPP_ | |
8 | ||
9 | #include <boost/process/detail/handler_base.hpp> | |
10 | ||
11 | namespace boost { namespace process { namespace detail { namespace posix { | |
12 | ||
13 | //does not extend anything. | |
14 | struct handler_base_ext : handler_base | |
15 | { | |
16 | template<typename Executor> | |
17 | void on_fork_error (Executor &, const std::error_code&) const {} | |
18 | ||
19 | template<typename Executor> | |
20 | void on_exec_setup (Executor &) const {} | |
21 | ||
22 | template<typename Executor> | |
23 | void on_exec_error (Executor &, const std::error_code&) const {} | |
24 | }; | |
25 | ||
26 | ||
27 | template <class Handler> | |
28 | struct on_fork_error_ : handler_base_ext | |
29 | { | |
30 | explicit on_fork_error_(Handler handler) : handler_(handler) {} | |
31 | ||
32 | template <class Executor> | |
33 | void on_fork_error(Executor &e, const std::error_code &ec) const | |
34 | { | |
35 | handler_(e, ec); | |
36 | } | |
37 | private: | |
38 | Handler handler_; | |
39 | }; | |
40 | ||
41 | ||
42 | template <class Handler> | |
43 | struct on_exec_setup_ : handler_base_ext | |
44 | { | |
45 | explicit on_exec_setup_(Handler handler) : handler_(handler) {} | |
46 | ||
47 | template <class Executor> | |
48 | void on_exec_setup(Executor &e) const | |
49 | { | |
50 | handler_(e); | |
51 | } | |
52 | private: | |
53 | Handler handler_; | |
54 | }; | |
55 | ||
56 | template <class Handler> | |
57 | struct on_exec_error_ : handler_base_ext | |
58 | { | |
59 | explicit on_exec_error_(Handler handler) : handler_(handler) {} | |
60 | ||
61 | template <class Executor> | |
62 | void on_exec_error(Executor &e, const std::error_code &ec) const | |
63 | { | |
64 | handler_(e, ec); | |
65 | } | |
66 | private: | |
67 | Handler handler_; | |
68 | }; | |
69 | ||
70 | }}}} | |
71 | ||
72 | ||
73 | ||
74 | #endif /* BOOST_PROCESS_DETAIL_POSIX_HANDLER_HPP_ */ |