$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r63106 - in sandbox/SOC/2010/process: boost boost/process libs/process/example
From: boris_at_[hidden]
Date: 2010-06-19 14:19:00
Author: bschaeling
Date: 2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
New Revision: 63106
URL: http://svn.boost.org/trac/boost/changeset/63106
Log:
Added pipe type to support asynchronous read/write operations
Added:
   sandbox/SOC/2010/process/boost/process/pipe.hpp   (contents, props changed)
   sandbox/SOC/2010/process/libs/process/example/wait_sync_child.cpp
      - copied unchanged from r63094, /sandbox/SOC/2010/process/libs/process/example/wait_child.cpp
Removed:
   sandbox/SOC/2010/process/libs/process/example/child_stdin.cpp
   sandbox/SOC/2010/process/libs/process/example/child_stdout.cpp
   sandbox/SOC/2010/process/libs/process/example/wait_child.cpp
Properties modified: 
   sandbox/SOC/2010/process/libs/process/example/   (props changed)
Text files modified: 
   sandbox/SOC/2010/process/boost/process.hpp                              |    34 +-----------------                      
   sandbox/SOC/2010/process/boost/process/all.hpp                          |     1                                         
   sandbox/SOC/2010/process/boost/process/context.hpp                      |    18 +++++-----                              
   sandbox/SOC/2010/process/boost/process/pistream.hpp                     |     2                                         
   sandbox/SOC/2010/process/boost/process/postream.hpp                     |     2                                         
   sandbox/SOC/2010/process/boost/process/stream_behavior.hpp              |    70 ++++++++++++++++++++++++++++----------- 
   sandbox/SOC/2010/process/libs/process/example/create_process.cpp        |    11 ++----                                  
   sandbox/SOC/2010/process/libs/process/example/read_async_from_child.cpp |    25 ++++----------                          
   sandbox/SOC/2010/process/libs/process/example/read_from_child.cpp       |    10 ++++-                                   
   sandbox/SOC/2010/process/libs/process/example/write_async_to_child.cpp  |    13 +++----                                 
   sandbox/SOC/2010/process/libs/process/example/write_to_child.cpp        |     4 +-                                      
   11 files changed, 91 insertions(+), 99 deletions(-)
Modified: sandbox/SOC/2010/process/boost/process.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process.hpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -14,50 +14,22 @@
  * \file boost/process.hpp 
  * 
  * Convenience header that includes all other Boost.Process public header 
- * files. It is important to note that those headers that are specific to 
- * a given platform are only included if the library is being used in that 
- * same platform. 
+ * files. 
  */ 
 
 #ifndef BOOST_PROCESS_HPP 
 #define BOOST_PROCESS_HPP 
 
 #include <boost/process/config.hpp> 
-
-#if defined(BOOST_POSIX_API) 
-/*
-#  include <boost/process/posix_child.hpp> 
-#  include <boost/process/posix_context.hpp> 
-#  include <boost/process/posix_operations.hpp> 
-#  include <boost/process/posix_status.hpp> 
-*/
-#elif defined(BOOST_WINDOWS_API) 
-/*
-#  include <boost/process/win32_child.hpp> 
-#  include <boost/process/win32_context.hpp> 
-#  include <boost/process/win32_operations.hpp> 
-*/
-#else 
-#  error "Unsupported platform." 
-#endif 
-/*
 #include <boost/process/child.hpp> 
 #include <boost/process/context.hpp> 
 #include <boost/process/environment.hpp> 
 #include <boost/process/operations.hpp> 
-#include <boost/process/pistream.hpp> 
-#include <boost/process/postream.hpp> 
-#include <boost/process/process.hpp> 
-#include <boost/process/self.hpp> 
-#include <boost/process/status.hpp> 
-#include <boost/process/stream_behavior.hpp> 
-*/
-#include <boost/process/child.hpp> 
-#include <boost/process/context.hpp> 
-#include <boost/process/operations.hpp> 
+#include <boost/process/pipe.hpp> 
 #include <boost/process/pistream.hpp> 
 #include <boost/process/postream.hpp> 
 #include <boost/process/process.hpp> 
 #include <boost/process/status.hpp> 
 #include <boost/process/stream_behavior.hpp> 
+
 #endif 
Modified: sandbox/SOC/2010/process/boost/process/all.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/all.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/all.hpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -25,6 +25,7 @@
 #include <boost/process/context.hpp> 
 #include <boost/process/environment.hpp> 
 #include <boost/process/operations.hpp> 
+#include <boost/process/pipe.hpp> 
 #include <boost/process/pistream.hpp> 
 #include <boost/process/postream.hpp> 
 #include <boost/process/process.hpp> 
Modified: sandbox/SOC/2010/process/boost/process/context.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/context.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/context.hpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -33,9 +33,9 @@
  */
 struct context
 {
-    boost::shared_ptr<stream_behavior> stdin_behavior;
-    boost::shared_ptr<stream_behavior> stdout_behavior;
-    boost::shared_ptr<stream_behavior> stderr_behavior;
+    boost::shared_ptr<behavior::stream> stdin_behavior;
+    boost::shared_ptr<behavior::stream> stdout_behavior;
+    boost::shared_ptr<behavior::stream> stderr_behavior;
     std::string process_name;
     std::string work_dir;
     environment environment;
@@ -48,13 +48,13 @@
      */ 
     context() 
 #if defined(BOOST_POSIX_API) 
-        : stdin_behavior(boost::make_shared<inherit>(inherit(STDIN_FILENO))), 
-        stdout_behavior(boost::make_shared<inherit>(inherit(STDOUT_FILENO))), 
-        stderr_behavior(boost::make_shared<inherit>(inherit(STDERR_FILENO))), 
+        : stdin_behavior(behavior::inherit::def(behavior::inherit(STDIN_FILENO))), 
+        stdout_behavior(behavior::inherit::def(behavior::inherit(STDOUT_FILENO))), 
+        stderr_behavior(behavior::inherit::def(behavior::inherit(STDERR_FILENO))), 
 #elif defined(BOOST_WINDOWS_API) 
-        : stdin_behavior(boost::make_shared<inherit>(inherit(::GetStdHandle(STD_INPUT_HANDLE)))), 
-        stdout_behavior(boost::make_shared<inherit>(inherit(::GetStdHandle(STD_OUTPUT_HANDLE)))), 
-        stderr_behavior(boost::make_shared<inherit>(inherit(::GetStdHandle(STD_ERROR_HANDLE)))), 
+        : stdin_behavior(behavior::inherit::def(::GetStdHandle(STD_INPUT_HANDLE))), 
+        stdout_behavior(behavior::inherit::def(::GetStdHandle(STD_OUTPUT_HANDLE))), 
+        stderr_behavior(behavior::inherit::def(::GetStdHandle(STD_ERROR_HANDLE))), 
 #endif 
         work_dir(self::get_work_dir()), 
         environment(self::get_environment()) 
Added: sandbox/SOC/2010/process/boost/process/pipe.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/process/boost/process/pipe.hpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -0,0 +1,43 @@
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+/**
+ * \file boost/process/pipe.hpp
+ *
+ * Includes the declaration of the pipe class.
+ */
+
+#ifndef BOOST_PROCESS_PIPE_HPP
+#define BOOST_PROCESS_PIPE_HPP
+
+#include <boost/process/config.hpp>
+#include <boost/asio.hpp>
+
+namespace boost {
+namespace process {
+
+/**
+ * The pipe class is a type definition for stream-based classes
+ * defined by Boost.Asio.
+ */
+#if defined(BOOST_POSIX_API)
+typedef boost::asio::posix::stream_descriptor pipe;
+#elif defined(BOOST_WINDOWS_API)
+typedef boost::asio::windows::stream_handle pipe;
+#else
+#   error "Unsupported platform."
+#endif
+
+}
+}
+
+#endif
Modified: sandbox/SOC/2010/process/boost/process/pistream.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/pistream.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/pistream.hpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -82,7 +82,7 @@
      * The file handle must not be copied. Copying invalidates
      * the source file handle making the pistream unusable.
      */
-    detail::file_handle &handle()
+    detail::file_handle &native()
     {
         return handle_;
     }
Modified: sandbox/SOC/2010/process/boost/process/postream.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/postream.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/postream.hpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -82,7 +82,7 @@
      * The file handle must not be copied. Copying invalidates
      * the source file handle making the postream unusable.
      */
-    detail::file_handle &handle()
+    detail::file_handle &native()
     {
         return handle_;
     }
Modified: sandbox/SOC/2010/process/boost/process/stream_behavior.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/stream_behavior.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/stream_behavior.hpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -13,7 +13,7 @@
 /**
  * \file boost/process/stream_behavior.hpp
  *
- * Includes the declaration of the stream_behavior classes.
+ * Includes the declaration of stream behavior classes.
  *
  */
 
@@ -32,8 +32,12 @@
 #   include <windows.h> 
 #endif 
 
+#include <boost/shared_ptr.hpp> 
+#include <boost/make_shared.hpp> 
+
 namespace boost {
 namespace process {
+namespace behavior {
 
 /*
  * BEHAVIOR | BEFORE fork/CreateProcess        | AFTER fork/CreateProcess 
@@ -52,10 +56,10 @@
 /**
  * Stream behaviors are used to configure streams of a child process.
  *
- * The class stream_behavior is the base class all other stream behavior
- * classes must be derived from.
+ * The class stream is the base class all other stream behavior classes
+ * must be derived from.
  */
-class stream_behavior 
+class stream 
 { 
 public: 
 #if defined(BOOST_POSIX_API) 
@@ -64,7 +68,12 @@
     typedef HANDLE native_type; 
 #endif 
 
-    virtual native_type get_child_end() const 
+    static boost::shared_ptr<stream> def() 
+    { 
+        return boost::make_shared<stream>(stream()); 
+    } 
+
+    virtual native_type get_child_end() 
     { 
 #if defined(BOOST_POSIX_API) 
         return -1; 
@@ -73,7 +82,7 @@
 #endif 
     } 
 
-    virtual native_type get_parent_end() const 
+    virtual native_type get_parent_end() 
     { 
 #if defined(BOOST_POSIX_API) 
         return -1; 
@@ -88,7 +97,7 @@
  *
  * A child process will not be able to use its streams.
  */
-typedef stream_behavior close; 
+typedef stream close; 
 
 /**
  * Stream behavior to make a child process inherit streams.
@@ -96,7 +105,7 @@
  * A child process will use the very same streams the current
  * process uses.
  */
-class inherit : public stream_behavior 
+class inherit : public stream 
 { 
 public: 
     inherit(native_type child_end) 
@@ -108,7 +117,12 @@
 #endif 
     } 
 
-    native_type get_child_end() const 
+    static boost::shared_ptr<inherit> def(native_type child_end) 
+    { 
+        return boost::make_shared<inherit>(inherit(child_end)); 
+    } 
+
+    native_type get_child_end() 
     { 
         return child_end_; 
     } 
@@ -123,12 +137,12 @@
  * A child process will be able to communicate with the current
  * process.
  */
-class capture : public stream_behavior 
+class pipe : public stream 
 { 
 public: 
     enum stream_type { input_stream, output_stream }; 
 
-    capture(stream_type stream) 
+    pipe(stream_type stream) 
     { 
         native_type natives[2]; 
 #if defined(BOOST_POSIX_API) 
@@ -151,12 +165,17 @@
 #endif 
     } 
 
-    native_type get_child_end() const 
+    static boost::shared_ptr<pipe> def(stream_type stream) 
+    { 
+        return boost::make_shared<pipe>(pipe(stream)); 
+    } 
+
+    native_type get_child_end() 
     { 
         return child_end_; 
     } 
 
-    native_type get_parent_end() const 
+    native_type get_parent_end() 
     { 
         return parent_end_; 
     } 
@@ -174,12 +193,12 @@
  * asynchronous I/O (as only named pipes support asynchronous I/O
  * on Windows).
  */
-class capture_with_named_pipe : public stream_behavior 
+class named_pipe : public stream 
 { 
 public: 
     enum stream_type { input_stream, output_stream }; 
 
-    capture_with_named_pipe(stream_type stream, std::string name = "") 
+    named_pipe(stream_type stream, std::string name = "") 
     { 
         native_type natives[2]; 
 #if defined(BOOST_POSIX_API) 
@@ -261,12 +280,17 @@
 #endif 
     } 
 
-    native_type get_child_end() const 
+    static boost::shared_ptr<named_pipe> def(stream_type stream) 
+    { 
+        return boost::make_shared<named_pipe>(named_pipe(stream)); 
+    } 
+
+    native_type get_child_end() 
     { 
         return child_end_; 
     } 
 
-    native_type get_parent_end() const 
+    native_type get_parent_end() 
     { 
         return parent_end_; 
     } 
@@ -282,12 +306,12 @@
  * A child process will be able to use streams. But data written to an 
  * output stream is discarded and data read from an input stream is 0.
  */
-class mute : public stream_behavior 
+class dummy : public stream 
 { 
 public: 
     enum stream_type { input_stream, output_stream }; 
 
-    mute(stream_type stream) 
+    dummy(stream_type stream) 
     { 
 #if defined(BOOST_POSIX_API) 
         std::string filename = (stream == input_stream) ? "/dev/zero" : "/dev/null"; 
@@ -301,7 +325,12 @@
 #endif 
     } 
 
-    native_type get_child_end() const 
+    static boost::shared_ptr<dummy> def(stream_type stream) 
+    { 
+        return boost::make_shared<dummy>(dummy(stream)); 
+    } 
+
+    native_type get_child_end() 
     { 
         return child_end_; 
     } 
@@ -312,5 +341,6 @@
 
 }
 }
+}
 
 #endif
Deleted: sandbox/SOC/2010/process/libs/process/example/child_stdin.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/child_stdin.cpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
+++ (empty file)
@@ -1,27 +0,0 @@
-//
-// Boost.Process
-// ~~~~~~~~~~~~~
-//
-// Copyright (c) 2006, 2007 Julio M. Merino Vidal
-// Copyright (c) 2008, 2009 Boris Schaeling
-// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#include <boost/process/all.hpp> 
-#include <string> 
-#include <iostream> 
-
-using namespace boost::process; 
-
-int main() 
-{ 
-    std::string exe = find_executable_in_path("ftp"); 
-    context ctx; 
-    ctx.stdin_behavior = boost::make_shared<capture>(capture(capture::input_stream)); 
-    child c = create_child(exe, ctx); 
-    postream &os = c.get_stdin(); 
-    os << "quit" << std::endl; 
-} 
Deleted: sandbox/SOC/2010/process/libs/process/example/child_stdout.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/child_stdout.cpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
+++ (empty file)
@@ -1,30 +0,0 @@
-//
-// Boost.Process
-// ~~~~~~~~~~~~~
-//
-// Copyright (c) 2006, 2007 Julio M. Merino Vidal
-// Copyright (c) 2008, 2009 Boris Schaeling
-// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#include <boost/process/all.hpp> 
-#include <boost/make_shared.hpp> 
-#include <string> 
-#include <iostream> 
-
-using namespace boost::process; 
-
-int main() 
-{ 
-    std::string exe = find_executable_in_path("hostname"); 
-    context ctx; 
-    ctx.stdout_behavior = boost::make_shared<capture>(capture(capture::output_stream)); 
-    child c = create_child(exe, ctx); 
-    pistream &is = c.get_stdout(); 
-    std::string hostname; 
-    is >> hostname; 
-    std::cout << hostname << std::endl; 
-} 
Modified: sandbox/SOC/2010/process/libs/process/example/create_process.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/create_process.cpp	(original)
+++ sandbox/SOC/2010/process/libs/process/example/create_process.cpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -1,4 +1,4 @@
-/
+//
 // Boost.Process
 // ~~~~~~~~~~~~~
 //
@@ -11,6 +11,7 @@
 //
 
 #include <boost/process/all.hpp> 
+#include <boost/make_shared.hpp> 
 #include <boost/assign/list_of.hpp> 
 #include <vector> 
 #include <string> 
@@ -27,11 +28,7 @@
 
     context ctx; 
     ctx.environment.insert(std::make_pair("NEW_ENV_VARIABLE", "VALUE")); 
-    
-    ctx.stdin_behavior = boost::make_shared<close>(close());
-    ctx.stdout_behavior = boost::make_shared<close>(close()); 
+    ctx.stdin_behavior = behavior::close::def();
+    ctx.stdout_behavior = behavior::close::def(); 
     child c3 = create_child(find_executable_in_path("hostname"), args, ctx); 
-
-    int x;
-    std::cin >> x;
 } 
Modified: sandbox/SOC/2010/process/libs/process/example/read_async_from_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/read_async_from_child.cpp	(original)
+++ sandbox/SOC/2010/process/libs/process/example/read_async_from_child.cpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -10,10 +10,9 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
 
-#include <boost/all/process.hpp> 
 #include <boost/asio.hpp> 
+#include <boost/process/all.hpp> 
 #include <boost/array.hpp> 
-#include <boost/bind.hpp> 
 #include <string> 
 #include <iostream> 
 
@@ -23,31 +22,21 @@
 io_service ioservice; 
 boost::array<char, 4096> buf; 
 
-void begin_read(pipe &read_end); 
-void end_read(const boost::system::error_code &ec, std::size_t bytes_transferred, pipe &read_end); 
+void handler(const boost::system::error_code &ec, std::size_t bytes_transferred); 
 
 int main() 
 { 
     std::string exe = find_executable_in_path("hostname"); 
     context ctx; 
-    ctx.stdout_behavior = boost::make_shared<capture>(capture(capture::output_stream)); ; 
+    ctx.stdout_behavior = behavior::named_pipe::def(behavior::named_pipe::output_stream); 
     child c = create_child(exe, ctx); 
     pistream &is = c.get_stdout(); 
-    pipe read_end(ioservice, is.native()); 
-    begin_read(read_end); 
+    pipe read_end(ioservice, is.native().release()); 
+    read_end.async_read_some(buffer(buf), handler); 
     ioservice.run(); 
 } 
 
-void begin_read(pipe &read_end) 
+void handler(const boost::system::error_code &ec, std::size_t bytes_transferred) 
 { 
-    read_end.async_read_some(buffer(buf), boost::bind(&end_read, placeholders::error, placeholders::bytes_transferred, read_end)); 
-} 
-
-void end_read(const boost::system::error_code &ec, std::size_t bytes_transferred, pipe &read_end) 
-{ 
-    if (!ec) 
-    { 
-      std::cout << std::string(buf.data(), bytes_transferred) << std::flush; 
-      begin_read(read_end); 
-    } 
+    std::cout << std::string(buf.data(), bytes_transferred) << std::flush; 
 } 
Modified: sandbox/SOC/2010/process/libs/process/example/read_from_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/read_from_child.cpp	(original)
+++ sandbox/SOC/2010/process/libs/process/example/read_from_child.cpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -10,7 +10,7 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
 
-#include <boost/all/process.hpp> 
+#include <boost/process/all.hpp> 
 #include <string> 
 #include <iostream> 
 
@@ -19,7 +19,11 @@
 int main() 
 { 
     std::string exe = find_executable_in_path("hostname"); 
-    child c = create_child(exe); 
+    context ctx; 
+    ctx.stdout_behavior = behavior::pipe::def(behavior::pipe::output_stream); 
+    child c = create_child(exe, ctx); 
     pistream &is = c.get_stdout(); 
-    std::cout << is.rdbuf(); 
+    std::string hostname; 
+    is >> hostname; 
+    std::cout << hostname << std::endl; 
 } 
Deleted: sandbox/SOC/2010/process/libs/process/example/wait_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/wait_child.cpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
+++ (empty file)
@@ -1,26 +0,0 @@
-//
-// Boost.Process
-// ~~~~~~~~~~~~~
-//
-// Copyright (c) 2006, 2007 Julio M. Merino Vidal
-// Copyright (c) 2008, 2009 Boris Schaeling
-// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#include <boost/process/all.hpp> 
-#include <string> 
-#include <iostream> 
-
-using namespace boost::process; 
-
-int main() 
-{ 
-    std::string exe = find_executable_in_path("hostname"); 
-    child c = create_child(exe); 
-    status s = c.wait(); 
-    if (s.exited()) 
-        std::cout << s.exit_code() << std::endl; 
-} 
Modified: sandbox/SOC/2010/process/libs/process/example/write_async_to_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/write_async_to_child.cpp	(original)
+++ sandbox/SOC/2010/process/libs/process/example/write_async_to_child.cpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -10,31 +10,30 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
 
-#include <boost/all/process.hpp> 
 #include <boost/asio.hpp> 
+#include <boost/process/all.hpp> 
 #include <boost/bind.hpp> 
 #include <string> 
-#include <iostream> 
 
 using namespace boost::process; 
 using namespace boost::asio; 
 
 io_service ioservice; 
 
-void end_write(const boost::system::error_code &ec); 
+void handler(const boost::system::error_code &ec, std::size_t bytes_transferred); 
 
 int main() 
 { 
     std::string exe = find_executable_in_path("ftp"); 
     context ctx; 
-    ctx.stdin_behavior = boost::make_shared<capture>(capture(capture::input_stream)); ; 
+    ctx.stdin_behavior = behavior::named_pipe::def(behavior::named_pipe::input_stream); 
     child c = create_child(exe, ctx); 
     postream &os = c.get_stdin(); 
-    pipe write_end(ioservice, os.native()); 
-    async_write(write_end, buffer("quit\n"), boost::bind(&end_write, placeholders::error)); 
+    pipe write_end(ioservice, os.native().release()); 
+    async_write(write_end, buffer("quit\n"), handler); 
     ioservice.run(); 
 } 
 
-void end_write(const boost::system::error_code &ec) 
+void handler(const boost::system::error_code &ec, std::size_t bytes_transferred) 
 { 
 } 
Modified: sandbox/SOC/2010/process/libs/process/example/write_to_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/write_to_child.cpp	(original)
+++ sandbox/SOC/2010/process/libs/process/example/write_to_child.cpp	2010-06-19 14:18:59 EDT (Sat, 19 Jun 2010)
@@ -10,7 +10,7 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
 
-#include <boost/all/process.hpp> 
+#include <boost/process/all.hpp> 
 #include <string> 
 #include <iostream> 
 
@@ -20,7 +20,7 @@
 { 
     std::string exe = find_executable_in_path("ftp"); 
     context ctx; 
-    ctx.stdin_behavior = boost::make_shared<capture>(capture(capture::input_stream));  
+    ctx.stdin_behavior = behavior::pipe::def(behavior::pipe::input_stream); 
     child c = create_child(exe, ctx); 
     postream &os = c.get_stdin(); 
     os << "quit" << std::endl;