summaryrefslogtreecommitdiff
path: root/boost/asio/impl
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/impl')
-rw-r--r--boost/asio/impl/buffered_read_stream.hpp2
-rw-r--r--boost/asio/impl/buffered_write_stream.hpp2
-rw-r--r--boost/asio/impl/connect.hpp2
-rw-r--r--boost/asio/impl/error.ipp2
-rw-r--r--boost/asio/impl/handler_alloc_hook.ipp2
-rw-r--r--boost/asio/impl/io_service.hpp2
-rw-r--r--boost/asio/impl/io_service.ipp2
-rw-r--r--boost/asio/impl/read.hpp2
-rw-r--r--boost/asio/impl/read_at.hpp2
-rw-r--r--boost/asio/impl/read_until.hpp2
-rw-r--r--boost/asio/impl/serial_port_base.hpp2
-rw-r--r--boost/asio/impl/serial_port_base.ipp2
-rw-r--r--boost/asio/impl/spawn.hpp41
-rw-r--r--boost/asio/impl/src.cpp2
-rw-r--r--boost/asio/impl/src.hpp2
-rw-r--r--boost/asio/impl/use_future.hpp2
-rw-r--r--boost/asio/impl/write.hpp2
-rw-r--r--boost/asio/impl/write_at.hpp2
18 files changed, 46 insertions, 29 deletions
diff --git a/boost/asio/impl/buffered_read_stream.hpp b/boost/asio/impl/buffered_read_stream.hpp
index 00bc2041dc..f45230870d 100644
--- a/boost/asio/impl/buffered_read_stream.hpp
+++ b/boost/asio/impl/buffered_read_stream.hpp
@@ -2,7 +2,7 @@
// impl/buffered_read_stream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/buffered_write_stream.hpp b/boost/asio/impl/buffered_write_stream.hpp
index 65012088e5..d49c9d9680 100644
--- a/boost/asio/impl/buffered_write_stream.hpp
+++ b/boost/asio/impl/buffered_write_stream.hpp
@@ -2,7 +2,7 @@
// impl/buffered_write_stream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/connect.hpp b/boost/asio/impl/connect.hpp
index 68a903eed8..b434f7f5d3 100644
--- a/boost/asio/impl/connect.hpp
+++ b/boost/asio/impl/connect.hpp
@@ -2,7 +2,7 @@
// impl/connect.hpp
// ~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/error.ipp b/boost/asio/impl/error.ipp
index ae43418988..635734fcd5 100644
--- a/boost/asio/impl/error.ipp
+++ b/boost/asio/impl/error.ipp
@@ -2,7 +2,7 @@
// impl/error.ipp
// ~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/handler_alloc_hook.ipp b/boost/asio/impl/handler_alloc_hook.ipp
index 2561f3b066..68b7912a78 100644
--- a/boost/asio/impl/handler_alloc_hook.ipp
+++ b/boost/asio/impl/handler_alloc_hook.ipp
@@ -2,7 +2,7 @@
// impl/handler_alloc_hook.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/io_service.hpp b/boost/asio/impl/io_service.hpp
index 4c6f2e1396..120d76caa9 100644
--- a/boost/asio/impl/io_service.hpp
+++ b/boost/asio/impl/io_service.hpp
@@ -2,7 +2,7 @@
// impl/io_service.hpp
// ~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/io_service.ipp b/boost/asio/impl/io_service.ipp
index 0bb5bbf8d4..b6daa0f588 100644
--- a/boost/asio/impl/io_service.ipp
+++ b/boost/asio/impl/io_service.ipp
@@ -2,7 +2,7 @@
// impl/io_service.ipp
// ~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/read.hpp b/boost/asio/impl/read.hpp
index 86f8776292..d5021a27c8 100644
--- a/boost/asio/impl/read.hpp
+++ b/boost/asio/impl/read.hpp
@@ -2,7 +2,7 @@
// impl/read.hpp
// ~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/read_at.hpp b/boost/asio/impl/read_at.hpp
index 877a7c7bb7..c2dbb3b070 100644
--- a/boost/asio/impl/read_at.hpp
+++ b/boost/asio/impl/read_at.hpp
@@ -2,7 +2,7 @@
// impl/read_at.hpp
// ~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/read_until.hpp b/boost/asio/impl/read_until.hpp
index 349c447c70..e516c1f0d6 100644
--- a/boost/asio/impl/read_until.hpp
+++ b/boost/asio/impl/read_until.hpp
@@ -2,7 +2,7 @@
// impl/read_until.hpp
// ~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/serial_port_base.hpp b/boost/asio/impl/serial_port_base.hpp
index 92be00d3a3..247de48bc3 100644
--- a/boost/asio/impl/serial_port_base.hpp
+++ b/boost/asio/impl/serial_port_base.hpp
@@ -2,7 +2,7 @@
// impl/serial_port_base.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
diff --git a/boost/asio/impl/serial_port_base.ipp b/boost/asio/impl/serial_port_base.ipp
index 51f66c161a..0c4fdbacd9 100644
--- a/boost/asio/impl/serial_port_base.ipp
+++ b/boost/asio/impl/serial_port_base.ipp
@@ -2,7 +2,7 @@
// impl/serial_port_base.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
diff --git a/boost/asio/impl/spawn.hpp b/boost/asio/impl/spawn.hpp
index 9f2f480f7d..7c6b2c240b 100644
--- a/boost/asio/impl/spawn.hpp
+++ b/boost/asio/impl/spawn.hpp
@@ -2,7 +2,7 @@
// impl/spawn.hpp
// ~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
@@ -17,6 +17,7 @@
#include <boost/asio/detail/config.hpp>
#include <boost/asio/async_result.hpp>
+#include <boost/asio/detail/atomic_count.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
@@ -38,6 +39,7 @@ namespace detail {
: coro_(ctx.coro_.lock()),
ca_(ctx.ca_),
handler_(ctx.handler_),
+ ready_(0),
ec_(ctx.ec_),
value_(0)
{
@@ -46,21 +48,24 @@ namespace detail {
void operator()(T value)
{
*ec_ = boost::system::error_code();
- *value_ = value;
- (*coro_)();
+ *value_ = BOOST_ASIO_MOVE_CAST(T)(value);
+ if (--*ready_ == 0)
+ (*coro_)();
}
void operator()(boost::system::error_code ec, T value)
{
*ec_ = ec;
- *value_ = value;
- (*coro_)();
+ *value_ = BOOST_ASIO_MOVE_CAST(T)(value);
+ if (--*ready_ == 0)
+ (*coro_)();
}
//private:
shared_ptr<typename basic_yield_context<Handler>::callee_type> coro_;
typename basic_yield_context<Handler>::caller_type& ca_;
Handler& handler_;
+ atomic_count* ready_;
boost::system::error_code* ec_;
T* value_;
};
@@ -73,6 +78,7 @@ namespace detail {
: coro_(ctx.coro_.lock()),
ca_(ctx.ca_),
handler_(ctx.handler_),
+ ready_(0),
ec_(ctx.ec_)
{
}
@@ -80,19 +86,22 @@ namespace detail {
void operator()()
{
*ec_ = boost::system::error_code();
- (*coro_)();
+ if (--*ready_ == 0)
+ (*coro_)();
}
void operator()(boost::system::error_code ec)
{
*ec_ = ec;
- (*coro_)();
+ if (--*ready_ == 0)
+ (*coro_)();
}
//private:
shared_ptr<typename basic_yield_context<Handler>::callee_type> coro_;
typename basic_yield_context<Handler>::caller_type& ca_;
Handler& handler_;
+ atomic_count* ready_;
boost::system::error_code* ec_;
};
@@ -172,8 +181,10 @@ public:
explicit async_result(detail::coro_handler<Handler, T>& h)
: handler_(h),
- ca_(h.ca_)
+ ca_(h.ca_),
+ ready_(2)
{
+ h.ready_ = &ready_;
out_ec_ = h.ec_;
if (!out_ec_) h.ec_ = &ec_;
h.value_ = &value_;
@@ -182,14 +193,16 @@ public:
type get()
{
handler_.coro_.reset(); // Must not hold shared_ptr to coro while suspended.
- ca_();
+ if (--ready_ != 0)
+ ca_();
if (!out_ec_ && ec_) throw boost::system::system_error(ec_);
- return value_;
+ return BOOST_ASIO_MOVE_CAST(type)(value_);
}
private:
detail::coro_handler<Handler, T>& handler_;
typename basic_yield_context<Handler>::caller_type& ca_;
+ detail::atomic_count ready_;
boost::system::error_code* out_ec_;
boost::system::error_code ec_;
type value_;
@@ -203,8 +216,10 @@ public:
explicit async_result(detail::coro_handler<Handler, void>& h)
: handler_(h),
- ca_(h.ca_)
+ ca_(h.ca_),
+ ready_(2)
{
+ h.ready_ = &ready_;
out_ec_ = h.ec_;
if (!out_ec_) h.ec_ = &ec_;
}
@@ -212,13 +227,15 @@ public:
void get()
{
handler_.coro_.reset(); // Must not hold shared_ptr to coro while suspended.
- ca_();
+ if (--ready_ != 0)
+ ca_();
if (!out_ec_ && ec_) throw boost::system::system_error(ec_);
}
private:
detail::coro_handler<Handler, void>& handler_;
typename basic_yield_context<Handler>::caller_type& ca_;
+ detail::atomic_count ready_;
boost::system::error_code* out_ec_;
boost::system::error_code ec_;
};
diff --git a/boost/asio/impl/src.cpp b/boost/asio/impl/src.cpp
index e8d239472c..15c071456c 100644
--- a/boost/asio/impl/src.cpp
+++ b/boost/asio/impl/src.cpp
@@ -2,7 +2,7 @@
// impl/src.cpp
// ~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/src.hpp b/boost/asio/impl/src.hpp
index 03536b9ac2..d638e3622f 100644
--- a/boost/asio/impl/src.hpp
+++ b/boost/asio/impl/src.hpp
@@ -2,7 +2,7 @@
// impl/src.hpp
// ~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/use_future.hpp b/boost/asio/impl/use_future.hpp
index 11194bd5db..5acc127bfa 100644
--- a/boost/asio/impl/use_future.hpp
+++ b/boost/asio/impl/use_future.hpp
@@ -2,7 +2,7 @@
// impl/use_future.hpp
// ~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/write.hpp b/boost/asio/impl/write.hpp
index ef0c092024..af3b279abe 100644
--- a/boost/asio/impl/write.hpp
+++ b/boost/asio/impl/write.hpp
@@ -2,7 +2,7 @@
// impl/write.hpp
// ~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
diff --git a/boost/asio/impl/write_at.hpp b/boost/asio/impl/write_at.hpp
index 0d0dc4bd47..85a7610c15 100644
--- a/boost/asio/impl/write_at.hpp
+++ b/boost/asio/impl/write_at.hpp
@@ -2,7 +2,7 @@
// impl/write_at.hpp
// ~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)