Update of /cvsroot/boost/boost/boost/asio/detail
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29300/detail

Modified Files:
        task_io_service.hpp win_iocp_io_service.hpp 
Log Message:
Add ability to specify the level of concurrency desired, which is currently
used by Win32's I/O completion ports.


Index: task_io_service.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/asio/detail/task_io_service.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- task_io_service.hpp 4 Nov 2006 07:14:08 -0000       1.3
+++ task_io_service.hpp 16 Nov 2006 11:50:56 -0000      1.4
@@ -48,6 +48,10 @@
   {
   }
 
+  void init(size_t concurrency_hint)
+  {
+  }
+
   // Destroy all user-defined handler objects owned by the service.
   void shutdown_service()
   {

Index: win_iocp_io_service.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/asio/detail/win_iocp_io_service.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- win_iocp_io_service.hpp     8 Nov 2006 05:32:12 -0000       1.4
+++ win_iocp_io_service.hpp     16 Nov 2006 11:50:56 -0000      1.5
@@ -48,11 +48,17 @@
   // Constructor.
   win_iocp_io_service(boost::asio::io_service& io_service)
     : boost::asio::io_service::service(io_service),
-      iocp_(::CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)),
+      iocp_(),
       outstanding_work_(0),
       interrupted_(0),
       shutdown_(0)
   {
+  }
+
+  void init(size_t concurrency_hint)
+  {
+    iocp_.handle = ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0,
+        static_cast<DWORD>((std::min<size_t>)(concurrency_hint, DWORD(~0))));
     if (!iocp_.handle)
     {
       DWORD last_error = ::GetLastError();
@@ -378,8 +384,8 @@
   struct iocp_holder
   {
     HANDLE handle;
-    iocp_holder(HANDLE h) : handle(h) {}
-    ~iocp_holder() { ::CloseHandle(handle); }
+    iocp_holder() : handle(0) {}
+    ~iocp_holder() { if (handle) ::CloseHandle(handle); }
   } iocp_;
 
   // The count of unfinished work.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to