Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:05

0001 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
0002 // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
0003 // Copyright (c) 2009 Boris Schaeling
0004 // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
0005 // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 
0010 #ifndef BOOST_PROCESS_POSIX_CHILD_HPP
0011 #define BOOST_PROCESS_POSIX_CHILD_HPP
0012 
0013 #include <utility>
0014 #include <system_error>
0015 
0016 namespace boost { namespace process { namespace detail { namespace posix {
0017 
0018 typedef ::pid_t pid_t;
0019 
0020 struct child_handle
0021 {
0022     int pid {-1};
0023     explicit child_handle(int pid) : pid(pid)
0024     {}
0025 
0026     child_handle()  = default;
0027     ~child_handle() = default;
0028 
0029     child_handle(const child_handle & c) = delete;
0030     child_handle(child_handle && c) : pid(c.pid)
0031     {
0032         c.pid = -1;
0033     }
0034     child_handle &operator=(const child_handle & c) = delete;
0035     child_handle &operator=(child_handle && c)
0036     {
0037         pid = c.pid;
0038         c.pid = -1;
0039         return *this;
0040     }
0041 
0042     int id() const
0043     {
0044         return pid;
0045     }
0046     bool in_group() const {return true;}
0047     bool in_group(std::error_code&) const noexcept {return true;}
0048 
0049     typedef int process_handle_t;
0050     process_handle_t process_handle() const { return pid; }
0051 
0052     bool valid() const
0053     {
0054         return pid != -1;
0055     }
0056 };
0057 
0058 }}}}
0059 
0060 #endif