ian@0
|
1 //
|
ian@0
|
2 // Boost.Process
|
ian@0
|
3 // ~~~~~~~~~~~~~
|
ian@0
|
4 //
|
ian@0
|
5 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
|
ian@0
|
6 // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
|
ian@0
|
7 // Copyright (c) 2009 Boris Schaeling
|
ian@0
|
8 // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
|
ian@0
|
9 //
|
ian@0
|
10 // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
ian@0
|
11 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
ian@0
|
12 //
|
ian@0
|
13
|
ian@0
|
14 /**
|
ian@0
|
15 * \file boost/process/detail/basic_status.hpp
|
ian@0
|
16 *
|
ian@0
|
17 * Includes the declaration of the basic status class.
|
ian@0
|
18 */
|
ian@0
|
19
|
ian@0
|
20 #ifndef BOOST_PROCESS_DETAIL_BASIC_STATUS_HPP
|
ian@0
|
21 #define BOOST_PROCESS_DETAIL_BASIC_STATUS_HPP
|
ian@0
|
22
|
ian@0
|
23 #include <boost/process/config.hpp>
|
ian@0
|
24 #include <boost/process/pid_type.hpp>
|
ian@0
|
25 #include <boost/asio.hpp>
|
ian@0
|
26
|
ian@0
|
27 namespace boost {
|
ian@0
|
28 namespace process {
|
ian@0
|
29 namespace detail {
|
ian@0
|
30
|
ian@0
|
31 /**
|
ian@0
|
32 * The basic_status class to wait for processes to exit.
|
ian@0
|
33 *
|
ian@0
|
34 * The basic_status class is a Boost.Asio I/O object and supports synchronous
|
ian@0
|
35 * and asynchronous wait operations. It must be instantiated with a Service.
|
ian@0
|
36 */
|
ian@0
|
37 template <typename Service>
|
ian@0
|
38 class basic_status
|
ian@0
|
39 : public boost::asio::basic_io_object<Service>
|
ian@0
|
40 {
|
ian@0
|
41 public:
|
ian@0
|
42 explicit basic_status(boost::asio::io_service &io_service)
|
ian@0
|
43 : boost::asio::basic_io_object<Service>(io_service)
|
ian@0
|
44 {
|
ian@0
|
45 }
|
ian@0
|
46
|
ian@0
|
47 /**
|
ian@0
|
48 * Waits synchronously for a process to exit.
|
ian@0
|
49 */
|
ian@0
|
50 int wait(pid_type pid)
|
ian@0
|
51 {
|
ian@0
|
52 return this->service.wait(this->implementation, pid);
|
ian@0
|
53 }
|
ian@0
|
54
|
ian@0
|
55 /**
|
ian@0
|
56 * Waits asynchronously for a process to exit.
|
ian@0
|
57 */
|
ian@0
|
58 template <typename Handler>
|
ian@0
|
59 void async_wait(pid_type pid, Handler handler)
|
ian@0
|
60 {
|
ian@0
|
61 this->service.async_wait(this->implementation, pid, handler);
|
ian@0
|
62 }
|
ian@0
|
63 };
|
ian@0
|
64
|
ian@0
|
65 }
|
ian@0
|
66 }
|
ian@0
|
67 }
|
ian@0
|
68
|
ian@0
|
69 #endif
|