$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: lists.drrngrvy_at_[hidden]
Date: 2007-08-20 21:18:50
Author: drrngrvy
Date: 2007-08-20 21:18:48 EDT (Mon, 20 Aug 2007)
New Revision: 38813
URL: http://svn.boost.org/trac/boost/changeset/38813
Log:
Local conflicts should be resolved now.
Text files modified: 
   sandbox/SOC/2007/cgi/boost/cgi/basic_request_acceptor.hpp   |    47 +++---------------                      
   sandbox/SOC/2007/cgi/boost/cgi/io_service.hpp               |     2                                         
   sandbox/SOC/2007/cgi/boost/cgi/io_service_provider.hpp      |   102 ++++++++++++++++++++++++++++++--------- 
   sandbox/SOC/2007/cgi/boost/cgi/io_service_provider_fwd.hpp  |     4 +                                       
   sandbox/SOC/2007/cgi/boost/cgi/request_acceptor_service.hpp |    30 +++++++++--                             
   sandbox/SOC/2007/cgi/boost/cgi/scgi.hpp                     |    14 +++++                                   
   sandbox/SOC/2007/cgi/boost/cgi/tags.hpp                     |     4 +                                       
   7 files changed, 132 insertions(+), 71 deletions(-)
Modified: sandbox/SOC/2007/cgi/boost/cgi/basic_request_acceptor.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/boost/cgi/basic_request_acceptor.hpp	(original)
+++ sandbox/SOC/2007/cgi/boost/cgi/basic_request_acceptor.hpp	2007-08-20 21:18:48 EDT (Mon, 20 Aug 2007)
@@ -12,15 +12,15 @@
 #include <boost/noncopyable.hpp>
 #include <boost/system/error_code.hpp>
 
-#include "basic_io_object.hpp"
-#include "is_async.hpp"
+#include <boost/asio/basic_io_object.hpp>
+#include "detail/throw_error.hpp"
 
 namespace cgi {
 
   template<typename RequestAcceptorService>
   class basic_request_acceptor
     : private boost::noncopyable
-    , public basic_io_object<RequestAcceptorService, is_async<RequestAcceptorService::protocol_type>::value>
+    , public boost::asio::basic_io_object<RequestAcceptorService>
   {
   public:
     //  typedef impl_type;
@@ -28,66 +28,35 @@
     typedef service_type::protocol_type    protocol_type;
 
     explicit basic_request_acceptor(basic_protocol_service<protocol_type>& s)
-      : boost::asio::use_service<RequestAcceptorService>(s.io_service())
+      : boost::asio::basic_io_object<RequestAcceptorService>(s.io_service())
     {
     }
 
     ~basic_request_acceptor()
     {
-      this->service.cancel();
     }
 
     template<typename CommonGatewayRequest>
     void accept(CommonGatewayRequest& request)
     {
       boost::system::error_code ec;
-      this->service.accept(request, ec);
-      boost::throw_error(ec);
+      this->service.accept(this->implementation, request, ec);
+      detail::throw_error(ec);
     }
 
     template<typename CommonGatewayRequest> boost::system::error_code&
     accept(CommonGatewayRequest& request, boost::system::error_code& ec)
     {
-      return this->service.accept(request, ec);
+      return this->service.accept(this->implementation, request, ec);
     }
 
     template<typename CommonGatewayRequest, typename Handler>
     void async_accept(CommonGatewayRequest& request, Handler handler)
     {
-      this->service.async_accept(request, handler);
+      this->service.async_accept(this->implementation, request, handler);
     }
-
-  private:
-    service_type& service_;
   };
 
-
-
-  /*
-  /// Specialisation for the CGI protocol
-  template<>
-  class basic_acceptor<protocol::cgi>
-    : private boost::noncopyable
-  {
-  public:
-  /// Accept a connection
-  /*
-   * For CGI, the connection is just a std::cin/cout wrapper, so is always
-   * connected
-   
-  void accept() { }
-  
-  /// Asynchronously accept a connection
-  /*
-   * Ask the service to asynchronously accept a connection. When one is accepted
-   * the handler is invoked (in a thread calling basic_service<>::run() ?).
-   
-  template<typename Handler>
-  void async_accept(Handler handler)
-  {
-    handler();
-  }
-     */
 } // namespace cgi
 
 #endif // CGI_BASIC_REQUEST_ACCEPTOR_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/boost/cgi/io_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/boost/cgi/io_service.hpp	(original)
+++ sandbox/SOC/2007/cgi/boost/cgi/io_service.hpp	2007-08-20 21:18:48 EDT (Mon, 20 Aug 2007)
@@ -13,7 +13,7 @@
 
 namespace cgi {
 
-  using boost::asio::io_service;
+  typedef boost::asio::io_service io_service;
 
 } // namespace cgi
 
Modified: sandbox/SOC/2007/cgi/boost/cgi/io_service_provider.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/boost/cgi/io_service_provider.hpp	(original)
+++ sandbox/SOC/2007/cgi/boost/cgi/io_service_provider.hpp	2007-08-20 21:18:48 EDT (Mon, 20 Aug 2007)
@@ -9,18 +9,19 @@
 #ifndef CGI_IO_SERVICE_PROVIDER_HPP_INCLUDED__
 #define CGI_IO_SERVICE_PROVIDER_HPP_INCLUDED__
 
-
-#include "detail/push_options.hpp"
-
+#include <list>
 #include <boost/ref.hpp>
 #include <boost/bind.hpp>
 #include <boost/thread.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/noncopyable.hpp>
-#include <boost/asio/io_service.hpp>
+//#include <boost/asio/io_service.hpp>
 //#include <boost/asio/strand.hpp>
 
 #include "tags.hpp"
+#include "io_service.hpp"
+#include "detail/push_options.hpp"
+
 
 namespace cgi {
 
@@ -39,37 +40,91 @@
    * each call to io_service() can get an io_service, call io_service::run() on
    * it and then return it.
    */
-  template<int IoServiceCount, typename Policy = tags::round_robin>
+  template<typename PoolingPolicy>
   class io_service_provider
     : private boost::noncopyable
   {
   public:
     io_service_provider(int)
-    //      : pos_(0)
-    //  , io_services_()
-    //  , strand_(io_services_[0])
+      : io_service_()
     {
     }
 
-    //    void run()
-    //{
-      // boost::shared_ptr<boost:thread>
-      //  thread(boost::bind(
-    //}
+    io_service_provider()
+      : io_service_()
+    {
+    }
 
-    // NOT THREAD-SAFE (but should be)
-    //boost::asio::io_service& io_service()
-    //{
-    // return io_services_[pos_++];
-    //}
+    cgi::io_service& io_service()
+    {
+      return io_service_;
+    }
+
+    void run()
+    {
+      io_service_.run();
+    }
+
+    void stop()
+    {
+      io_service_.stop();
+    }
+
+    void reset()
+    {
+      io_service_.reset();
+    }
   private:
-    //int pos_;
-    //boost::asio::io_service io_services_[IoServiceCount];
-    //boost::asio::io_service::work works_[IoServiceCount];
-    //boost::asio::io_service::strand strand_;
+    cgi::io_service io_service_;
   };
 
 
+  /*
+  template<>
+  class io_service_provider<tags::service_pool>
+  {
+  public:
+    typedef std::list<cgi::io_service> impl_type;
+
+    io_service_provider(int pool_size)
+      : io_services_(pool_size)
+      , current_(io_services_.begin())
+    {
+    }
+
+    cgi::io_service& io_service()
+    {
+      return boost::ref(*current_++);
+    }
+
+    void run()
+    {
+      std::for_each(io_services_.begin(), io_services_.end()
+                    , boost::bind(&cgi::io_service::run, boost::ref(_1)));
+    }
+
+    void stop()
+    {
+      std::for_each(io_services_.begin(), io_services_.end()
+                    , boost::bind(&cgi::io_service::stop, boost::ref(_1)));
+    }
+
+    void reset()
+    {
+      std::for_each(io_services_.begin(), io_services_.end()
+                    , boost::bind(&cgi::io_service::reset, boost::ref(_1)));
+    }
+
+    impl_type& impl()
+    {
+      return io_services_;
+    }
+
+  private:
+    impl_type io_services_;
+    impl_type::iterator current_;
+  };
+  */
 
   /// Specialization for multi-queue/single-io_service strategy
   /**
@@ -112,7 +167,7 @@
   };
 ********************************/
 
-
+      /*
   /// Specialization for io_service-per-queue strategy
   template<typename Policy>
   class io_service_provider<1, Policy>//tags::>
@@ -209,6 +264,7 @@
 
     //boost::asio::io_service::strand strand_;
   };
+      */
 
 } // namespace cgi
 
Modified: sandbox/SOC/2007/cgi/boost/cgi/io_service_provider_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/boost/cgi/io_service_provider_fwd.hpp	(original)
+++ sandbox/SOC/2007/cgi/boost/cgi/io_service_provider_fwd.hpp	2007-08-20 21:18:48 EDT (Mon, 20 Aug 2007)
@@ -9,9 +9,11 @@
 #ifndef CGI_IO_SERVICE_PROVIDER_FWD_HPP_INCLUDED__
 #define CGI_IO_SERVICE_PROVIDER_FWD_HPP_INCLUDED__
 
+#include "tags.hpp"
+
 namespace cgi {
 
-  template<int, typename>
+  template<typename = tags::single_service>
   class io_service_provider;
 
 } // namespace cgi
Modified: sandbox/SOC/2007/cgi/boost/cgi/request_acceptor_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/boost/cgi/request_acceptor_service.hpp	(original)
+++ sandbox/SOC/2007/cgi/boost/cgi/request_acceptor_service.hpp	2007-08-20 21:18:48 EDT (Mon, 20 Aug 2007)
@@ -9,17 +9,24 @@
 #ifndef CGI_REQUEST_ACCEPTOR_SERVICE_HPP_INCLUDED
 #define CGI_REQUEST_ACCEPTOR_SERVICE_HPP_INCLUDED
 
+#include "detail/throw_error.hpp"
+#include "detail/protocol_traits.hpp"
+#include "detail/service_base.hpp"
+
 namespace cgi {
 
   template<typename Protocol>
   class request_acceptor_service
+    : public detail::service_base<request_acceptor_service<Protocol> >
   {
+    typedef detail::protocol_traits<Protocol>::acceptor_service_impl
+      service_impl_type;
   public:
+    typedef typename service_impl_type::impl_type  implementation_type;
     typedef Protocol protocol_type;
-    typedef basic_request<Protocol, ...>    implementation_type;
 
-    explicit request_acceptor_service(basic_protocol_service<protocol_type>& s)
-      : pservice_(s)
+    request_acceptor_service(basic_protocol_service<protocol_type>& s)
+      : detail::service_base<request_acceptor_service<Protocol>(s.io_service())
     {
     }
 
@@ -29,10 +36,12 @@
 
     void construct(implementation_type& impl)
     {
+      service_impl_.construct(impl);
     }
 
     void destroy(implementation_type& impl)
     {
+      service_impl_.destroy(impl);
     }
 
     /// Accept a request
@@ -42,8 +51,11 @@
      */
     template<typename CommonGatewayRequest>
     boost::system::error_code&
-    accept(CommonGatewayRequest& request, boost::system::error_code& ec)
+    accept(implementation_type& impl, CommonGatewayRequest& request
+          , boost::system::error_code& ec)
     {
+      return service_impl_.accept(impl, request, ec);
+      /*      
       boost::thread::mutex::scoped_lock lk(io_service_.mutex_);
       if( !io_service_.request_queue_.empty() )
       {
@@ -56,12 +68,16 @@
       pservice_.gateway_.accept(&request.connection(), ec);
             
       return ec;
+      */
     }
 
     /// Asynchronously accept a request
     template<typename CommonGatewayRequest, typename Handler>
-    void async_accept(CommonGatewayRequest& request, Handler handler)
+    void async_accept(implementation_type& impl, CommonGatewayRequest& request
+                     , Handler handler)
     {
+      service_impl_.async_accept(impl, request, handler);
+      /*
       boost::thread::mutex::scoped_lock lk(io_service_.mutex_);
       if( !io_service_.request_queue_.empty() )
       {
@@ -72,10 +88,12 @@
       }
       lk.unlock();
       pservice_.gateway_.async_accept(request.connection(), handler);
+      */
     }
 
   private:
-    basic_protocol_service<protocol_type>& pservice_;
+    service_impl_type& service_impl_;
+    //    basic_protocol_service<protocol_type>& pservice_;
   };
 
 } // namespace cgi
Modified: sandbox/SOC/2007/cgi/boost/cgi/scgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/boost/cgi/scgi.hpp	(original)
+++ sandbox/SOC/2007/cgi/boost/cgi/scgi.hpp	2007-08-20 21:18:48 EDT (Mon, 20 Aug 2007)
@@ -10,5 +10,19 @@
 #define CGI_SCGI_HPP_INCLUDED__
 
 // #include all scgi-related headers only
+#include "scgi/service.hpp"
+#include "scgi/request_service.hpp"
+#include "scgi/request_acceptor_service.hpp"
+#include "detail/common_headers.hpp"
+
+namespace cgi {
+
+  typedef basic_request_acceptor<scgi_request_acceptor_service> scgi_acceptor;
+
+# ifndef CGI_NO_IMPLICIT_TYPEDEFS
+    typedef scgi_acceptor acceptor;
+# endif
+
+} // namespace cgi
 
 #endif // CGI_SCGI_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/boost/cgi/tags.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/boost/cgi/tags.hpp	(original)
+++ sandbox/SOC/2007/cgi/boost/cgi/tags.hpp	2007-08-20 21:18:48 EDT (Mon, 20 Aug 2007)
@@ -22,7 +22,9 @@
    struct fcgi {};
    struct scgi {};
 
-   // IoServiceProvider Policy types
+   // IoServiceProvider PoolingPolicy types
+   struct single_service {};
+   struct service_pool {};
    struct round_robin {};
 
    // Connection types