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