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
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
Defines various macros.
notify_io_service_< IOService > notify_io_service(IOService &io_service)