notify_io_service.hpp
Go to the documentation of this file.
1 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
2 // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
3 // Copyright (c) 2009 Boris Schaeling
4 // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
5 // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 
10 #pragma once
11 
12 #include <boost/process/config.hpp>
14 
16 {
17 
18  template <class IOService>
20  {
21  public:
22  explicit notify_io_service_(IOService& io_service) : io_service_(io_service)
23  {
24  }
25 
26  template <class PosixExecutor>
27  void
28  on_fork_setup(PosixExecutor&) const
29  {
30  io_service_.notify_fork(IOService::fork_prepare);
31  }
32 
33  template <class PosixExecutor>
34  void
35  on_fork_success(PosixExecutor&) const
36  {
37  io_service_.notify_fork(IOService::fork_parent);
38  }
39 
40  template <class PosixExecutor>
41  void
42  on_exec_setup(PosixExecutor&) const
43  {
44  io_service_.notify_fork(IOService::fork_child);
45  }
46 
47  private:
48  IOService& io_service_;
49  };
50 
51  template <class IOService>
52  notify_io_service_<IOService>
53  notify_io_service(IOService& io_service)
54  {
55  return notify_io_service_<IOService>(io_service);
56  }
57 
58 } // namespace boost::process::posix::initializers
boost::process::posix::initializers::notify_io_service_
Definition: notify_io_service.hpp:19
boost::process::posix::initializers::notify_io_service_::notify_io_service_
notify_io_service_(IOService &io_service)
Definition: notify_io_service.hpp:22
config.hpp
initializer_base.hpp
boost::process::posix::initializers::notify_io_service_::on_fork_setup
void on_fork_setup(PosixExecutor &) const
Definition: notify_io_service.hpp:28
boost::process::posix::initializers
Definition: bind_fd.hpp:16
boost::process::posix::initializers::notify_io_service
notify_io_service_< IOService > notify_io_service(IOService &io_service)
Definition: notify_io_service.hpp:53
boost::process::posix::initializers::initializer_base
Definition: initializer_base.hpp:15
boost::process::posix::initializers::notify_io_service_::on_exec_setup
void on_exec_setup(PosixExecutor &) const
Definition: notify_io_service.hpp:42
boost::process::posix::initializers::notify_io_service_::on_fork_success
void on_fork_success(PosixExecutor &) const
Definition: notify_io_service.hpp:35