Commit dec1c50d authored by Markus Wanner's avatar Markus Wanner

Imported Upstream version 1.6.1

parent 0018c9d7
Makefile
Makefile.in
aclocal.m4
autom4te.cache
compile
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
/doc
/lib
/boostified
*.gz
*.bz2
*.zip
asio version 1.6.0
Released Sunday, 11 September 2011.
asio version 1.6.1
Released Tuesday, 22 May 2012.
See doc/index.html for API documentation and a tutorial.
......@@ -1586,8 +1586,8 @@
/doc/asio/reference/datagram_socket_service/endpoint_type.html
/doc/asio/reference/datagram_socket_service/get_io_service.html
/doc/asio/reference/datagram_socket_service/get_option.html
/doc/asio/reference/datagram_socket_service.html
/doc/asio/reference/DatagramSocketService.html
/doc/asio/reference/datagram_socket_service.html
/doc/asio/reference/datagram_socket_service/id.html
/doc/asio/reference/datagram_socket_service/implementation_type.html
/doc/asio/reference/datagram_socket_service/io_control.html
......@@ -1735,10 +1735,12 @@
/doc/asio/reference/io_service/run/overload1.html
/doc/asio/reference/io_service/run/overload2.html
/doc/asio/reference/io_service__service/
/doc/asio/reference/io_service__service/fork_service.html
/doc/asio/reference/io_service__service/get_io_service.html
/doc/asio/reference/io_service__service.html
/doc/asio/reference/io_service__service/_service.html
/doc/asio/reference/io_service__service/service.html
/doc/asio/reference/io_service__service/shutdown_service.html
/doc/asio/reference/io_service/stop.html
/doc/asio/reference/io_service/stopped.html
/doc/asio/reference/io_service__strand/
......@@ -1959,8 +1961,8 @@
/doc/asio/reference/ip__basic_resolver_iterator/create/overload1.html
/doc/asio/reference/ip__basic_resolver_iterator/create/overload2.html
/doc/asio/reference/ip__basic_resolver_iterator/difference_type.html
/doc/asio/reference/ip__basic_resolver_iterator.html
/doc/asio/reference/ip__basic_resolver/iterator.html
/doc/asio/reference/ip__basic_resolver_iterator.html
/doc/asio/reference/ip__basic_resolver_iterator/iterator_category.html
/doc/asio/reference/ip__basic_resolver_iterator/operator_arrow_.html
/doc/asio/reference/ip__basic_resolver_iterator/operator_eq__eq_.html
......@@ -1987,8 +1989,8 @@
/doc/asio/reference/ip__basic_resolver_query/flags.html
/doc/asio/reference/ip__basic_resolver_query/hints.html
/doc/asio/reference/ip__basic_resolver_query/host_name.html
/doc/asio/reference/ip__basic_resolver_query.html
/doc/asio/reference/ip__basic_resolver/query.html
/doc/asio/reference/ip__basic_resolver_query.html
/doc/asio/reference/ip__basic_resolver_query/numeric_host.html
/doc/asio/reference/ip__basic_resolver_query/numeric_service.html
/doc/asio/reference/ip__basic_resolver_query/passive.html
......@@ -2370,8 +2372,8 @@
/doc/asio/reference/raw_socket_service/endpoint_type.html
/doc/asio/reference/raw_socket_service/get_io_service.html
/doc/asio/reference/raw_socket_service/get_option.html
/doc/asio/reference/raw_socket_service.html
/doc/asio/reference/RawSocketService.html
/doc/asio/reference/raw_socket_service.html
/doc/asio/reference/raw_socket_service/id.html
/doc/asio/reference/raw_socket_service/implementation_type.html
/doc/asio/reference/raw_socket_service/io_control.html
......@@ -2450,8 +2452,8 @@
/doc/asio/reference/seq_packet_socket_service/endpoint_type.html
/doc/asio/reference/seq_packet_socket_service/get_io_service.html
/doc/asio/reference/seq_packet_socket_service/get_option.html
/doc/asio/reference/seq_packet_socket_service.html
/doc/asio/reference/SeqPacketSocketService.html
/doc/asio/reference/seq_packet_socket_service.html
/doc/asio/reference/seq_packet_socket_service/id.html
/doc/asio/reference/seq_packet_socket_service/implementation_type.html
/doc/asio/reference/seq_packet_socket_service/io_control.html
......@@ -2526,8 +2528,8 @@
/doc/asio/reference/serial_port_service/destroy.html
/doc/asio/reference/serial_port_service/get_io_service.html
/doc/asio/reference/serial_port_service/get_option.html
/doc/asio/reference/serial_port_service.html
/doc/asio/reference/SerialPortService.html
/doc/asio/reference/serial_port_service.html
/doc/asio/reference/serial_port_service/id.html
/doc/asio/reference/serial_port_service/implementation_type.html
/doc/asio/reference/serial_port_service/is_open.html
......@@ -2560,8 +2562,8 @@
/doc/asio/reference/signal_set_service/construct.html
/doc/asio/reference/signal_set_service/destroy.html
/doc/asio/reference/signal_set_service/get_io_service.html
/doc/asio/reference/signal_set_service.html
/doc/asio/reference/SignalSetService.html
/doc/asio/reference/signal_set_service.html
/doc/asio/reference/signal_set_service/id.html
/doc/asio/reference/signal_set_service/implementation_type.html
/doc/asio/reference/signal_set_service/remove.html
......@@ -2578,8 +2580,8 @@
/doc/asio/reference/socket_acceptor_service/endpoint_type.html
/doc/asio/reference/socket_acceptor_service/get_io_service.html
/doc/asio/reference/socket_acceptor_service/get_option.html
/doc/asio/reference/socket_acceptor_service.html
/doc/asio/reference/SocketAcceptorService.html
/doc/asio/reference/socket_acceptor_service.html
/doc/asio/reference/socket_acceptor_service/id.html
/doc/asio/reference/socket_acceptor_service/implementation_type.html
/doc/asio/reference/socket_acceptor_service/io_control.html
......@@ -2800,8 +2802,8 @@
/doc/asio/reference/stream_socket_service/endpoint_type.html
/doc/asio/reference/stream_socket_service/get_io_service.html
/doc/asio/reference/stream_socket_service/get_option.html
/doc/asio/reference/stream_socket_service.html
/doc/asio/reference/StreamSocketService.html
/doc/asio/reference/stream_socket_service.html
/doc/asio/reference/stream_socket_service/id.html
/doc/asio/reference/stream_socket_service/implementation_type.html
/doc/asio/reference/stream_socket_service/io_control.html
......@@ -3204,6 +3206,7 @@
/include/asio/detail/config.hpp
/include/asio/detail/consuming_buffers.hpp
/include/asio/detail/deadline_timer_service.hpp
/include/asio/detail/dependent_type.hpp
/include/asio/detail/descriptor_ops.hpp
/include/asio/detail/descriptor_read_op.hpp
/include/asio/detail/descriptor_write_op.hpp
......@@ -3716,6 +3719,7 @@
/src/Makefile.msc
/src/tests/
/src/tests/latency/
/src/tests/latency/allocator.hpp
/src/tests/latency/coroutine.hpp
/src/tests/latency/high_res_clock.hpp
/src/tests/latency/tcp_client.cpp
......
......@@ -42,6 +42,7 @@
/boost/asio/detail/config.hpp
/boost/asio/detail/consuming_buffers.hpp
/boost/asio/detail/deadline_timer_service.hpp
/boost/asio/detail/dependent_type.hpp
/boost/asio/detail/descriptor_ops.hpp
/boost/asio/detail/descriptor_read_op.hpp
/boost/asio/detail/descriptor_write_op.hpp
......@@ -2096,8 +2097,8 @@
/doc/html/boost_asio/reference/datagram_socket_service/endpoint_type.html
/doc/html/boost_asio/reference/datagram_socket_service/get_io_service.html
/doc/html/boost_asio/reference/datagram_socket_service/get_option.html
/doc/html/boost_asio/reference/datagram_socket_service.html
/doc/html/boost_asio/reference/DatagramSocketService.html
/doc/html/boost_asio/reference/datagram_socket_service.html
/doc/html/boost_asio/reference/datagram_socket_service/id.html
/doc/html/boost_asio/reference/datagram_socket_service/implementation_type.html
/doc/html/boost_asio/reference/datagram_socket_service/io_control.html
......@@ -2447,8 +2448,8 @@
/doc/html/boost_asio/reference/ip__basic_resolver_iterator/create/overload1.html
/doc/html/boost_asio/reference/ip__basic_resolver_iterator/create/overload2.html
/doc/html/boost_asio/reference/ip__basic_resolver_iterator/difference_type.html
/doc/html/boost_asio/reference/ip__basic_resolver_iterator.html
/doc/html/boost_asio/reference/ip__basic_resolver/iterator.html
/doc/html/boost_asio/reference/ip__basic_resolver_iterator.html
/doc/html/boost_asio/reference/ip__basic_resolver_iterator/iterator_category.html
/doc/html/boost_asio/reference/ip__basic_resolver_iterator/operator_arrow_.html
/doc/html/boost_asio/reference/ip__basic_resolver_iterator/operator_eq__eq_.html
......@@ -2475,8 +2476,8 @@
/doc/html/boost_asio/reference/ip__basic_resolver_query/flags.html
/doc/html/boost_asio/reference/ip__basic_resolver_query/hints.html
/doc/html/boost_asio/reference/ip__basic_resolver_query/host_name.html
/doc/html/boost_asio/reference/ip__basic_resolver_query.html
/doc/html/boost_asio/reference/ip__basic_resolver/query.html
/doc/html/boost_asio/reference/ip__basic_resolver_query.html
/doc/html/boost_asio/reference/ip__basic_resolver_query/numeric_host.html
/doc/html/boost_asio/reference/ip__basic_resolver_query/numeric_service.html
/doc/html/boost_asio/reference/ip__basic_resolver_query/passive.html
......@@ -2872,8 +2873,8 @@
/doc/html/boost_asio/reference/raw_socket_service/endpoint_type.html
/doc/html/boost_asio/reference/raw_socket_service/get_io_service.html
/doc/html/boost_asio/reference/raw_socket_service/get_option.html
/doc/html/boost_asio/reference/raw_socket_service.html
/doc/html/boost_asio/reference/RawSocketService.html
/doc/html/boost_asio/reference/raw_socket_service.html
/doc/html/boost_asio/reference/raw_socket_service/id.html
/doc/html/boost_asio/reference/raw_socket_service/implementation_type.html
/doc/html/boost_asio/reference/raw_socket_service/io_control.html
......@@ -2952,8 +2953,8 @@
/doc/html/boost_asio/reference/seq_packet_socket_service/endpoint_type.html
/doc/html/boost_asio/reference/seq_packet_socket_service/get_io_service.html
/doc/html/boost_asio/reference/seq_packet_socket_service/get_option.html
/doc/html/boost_asio/reference/seq_packet_socket_service.html
/doc/html/boost_asio/reference/SeqPacketSocketService.html
/doc/html/boost_asio/reference/seq_packet_socket_service.html
/doc/html/boost_asio/reference/seq_packet_socket_service/id.html
/doc/html/boost_asio/reference/seq_packet_socket_service/implementation_type.html
/doc/html/boost_asio/reference/seq_packet_socket_service/io_control.html
......@@ -3028,8 +3029,8 @@
/doc/html/boost_asio/reference/serial_port_service/destroy.html
/doc/html/boost_asio/reference/serial_port_service/get_io_service.html
/doc/html/boost_asio/reference/serial_port_service/get_option.html
/doc/html/boost_asio/reference/serial_port_service.html
/doc/html/boost_asio/reference/SerialPortService.html
/doc/html/boost_asio/reference/serial_port_service.html
/doc/html/boost_asio/reference/serial_port_service/id.html
/doc/html/boost_asio/reference/serial_port_service/implementation_type.html
/doc/html/boost_asio/reference/serial_port_service/is_open.html
......@@ -3062,8 +3063,8 @@
/doc/html/boost_asio/reference/signal_set_service/construct.html
/doc/html/boost_asio/reference/signal_set_service/destroy.html
/doc/html/boost_asio/reference/signal_set_service/get_io_service.html
/doc/html/boost_asio/reference/signal_set_service.html
/doc/html/boost_asio/reference/SignalSetService.html
/doc/html/boost_asio/reference/signal_set_service.html
/doc/html/boost_asio/reference/signal_set_service/id.html
/doc/html/boost_asio/reference/signal_set_service/implementation_type.html
/doc/html/boost_asio/reference/signal_set_service/remove.html
......@@ -3080,8 +3081,8 @@
/doc/html/boost_asio/reference/socket_acceptor_service/endpoint_type.html
/doc/html/boost_asio/reference/socket_acceptor_service/get_io_service.html
/doc/html/boost_asio/reference/socket_acceptor_service/get_option.html
/doc/html/boost_asio/reference/socket_acceptor_service.html
/doc/html/boost_asio/reference/SocketAcceptorService.html
/doc/html/boost_asio/reference/socket_acceptor_service.html
/doc/html/boost_asio/reference/socket_acceptor_service/id.html
/doc/html/boost_asio/reference/socket_acceptor_service/implementation_type.html
/doc/html/boost_asio/reference/socket_acceptor_service/io_control.html
......@@ -3302,8 +3303,8 @@
/doc/html/boost_asio/reference/stream_socket_service/endpoint_type.html
/doc/html/boost_asio/reference/stream_socket_service/get_io_service.html
/doc/html/boost_asio/reference/stream_socket_service/get_option.html
/doc/html/boost_asio/reference/stream_socket_service.html
/doc/html/boost_asio/reference/StreamSocketService.html
/doc/html/boost_asio/reference/stream_socket_service.html
/doc/html/boost_asio/reference/stream_socket_service/id.html
/doc/html/boost_asio/reference/stream_socket_service/implementation_type.html
/doc/html/boost_asio/reference/stream_socket_service/io_control.html
......@@ -4009,6 +4010,17 @@
/libs/asio/test/is_write_buffered.cpp
/libs/asio/test/Jamfile
/libs/asio/test/Jamfile.v2
/libs/asio/test/latency/
/libs/asio/test/latency/allocator.hpp
/libs/asio/test/latency/coroutine.hpp
/libs/asio/test/latency/high_res_clock.hpp
/libs/asio/test/latency/Jamfile.v2
/libs/asio/test/latency/tcp_client.cpp
/libs/asio/test/latency/tcp_server.cpp
/libs/asio/test/latency/udp_client.cpp
/libs/asio/test/latency/udp_server.cpp
/libs/asio/test/latency/unyield.hpp
/libs/asio/test/latency/yield.hpp
/libs/asio/test/local/
/libs/asio/test/local/basic_endpoint.cpp
/libs/asio/test/local/connect_pair.cpp
......
......@@ -403,6 +403,25 @@ sub copy_unit_tests
}
}
sub copy_latency_tests
{
my @dirs = (
"src/tests/latency");
our $boost_dir;
foreach my $dir (@dirs)
{
my @files = ( glob("$dir/*.*pp"), glob("$dir/Jamfile*") );
foreach my $file (@files)
{
my $from = $file;
my $to = $file;
$to =~ s/^src\/tests\/latency\//$boost_dir\/libs\/asio\/test\/latency\//;
copy_source_file($from, $to);
}
}
}
sub copy_examples
{
my @dirs = (
......@@ -501,6 +520,7 @@ sub copy_tools
copy_include_files();
create_lib_directory();
copy_unit_tests();
copy_latency_tests();
copy_examples();
copy_doc();
copy_tools();
AC_INIT(asio, [1.6.0])
AC_INIT(asio, [1.6.1])
AC_CONFIG_SRCDIR(include/asio.hpp)
AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE([tar-ustar])
......@@ -17,65 +17,90 @@ AC_ARG_WITH(boost,
CPPFLAGS="$CPPFLAGS -I${withval}"
],
[
BOOSTDIR="`pwd`/../boost_1_45_0"
BOOSTDIR="`pwd`/../boost_1_49_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_44_0"
BOOSTDIR="`pwd`/../boost_1_48_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_43_0"
BOOSTDIR="`pwd`/../boost_1_47_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_42_0"
BOOSTDIR="`pwd`/../boost_1_46_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_41_0"
BOOSTDIR="`pwd`/../boost_1_46_1"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_40_0"
BOOSTDIR="`pwd`/../boost_1_45_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_39_0"
BOOSTDIR="`pwd`/../boost_1_44_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_38_0"
BOOSTDIR="`pwd`/../boost_1_43_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_37_0"
BOOSTDIR="`pwd`/../boost_1_42_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_36_0"
BOOSTDIR="`pwd`/../boost_1_41_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_35_0"
BOOSTDIR="`pwd`/../boost_1_40_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_34_1"
BOOSTDIR="`pwd`/../boost_1_39_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_34_0"
BOOSTDIR="`pwd`/../boost_1_38_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_33_1"
BOOSTDIR="`pwd`/../boost_1_37_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_33_0"
BOOSTDIR="`pwd`/../boost_1_36_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_35_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_34_1"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_34_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_33_1"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
else
BOOSTDIR="`pwd`/../boost_1_33_0"
if test -d "${BOOSTDIR}"; then
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR}"
fi
fi
fi
fi
fi
fi
fi
fi
......
......@@ -40,6 +40,7 @@ nobase_include_HEADERS = \
asio/detail/config.hpp \
asio/detail/consuming_buffers.hpp \
asio/detail/deadline_timer_service.hpp \
asio/detail/dependent_type.hpp \
asio/detail/descriptor_ops.hpp \
asio/detail/descriptor_read_op.hpp \
asio/detail/descriptor_write_op.hpp \
......
......@@ -17,7 +17,9 @@
#include "asio/detail/config.hpp"
#if defined(ASIO_HAS_STD_ATOMIC)
#if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS)
// Nothing to include.
#elif defined(ASIO_HAS_STD_ATOMIC)
# include <atomic>
#else // defined(ASIO_HAS_STD_ATOMIC)
# include <boost/detail/atomic_count.hpp>
......@@ -26,7 +28,9 @@
namespace asio {
namespace detail {
#if defined(ASIO_HAS_STD_ATOMIC)
#if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS)
typedef long atomic_count;
#elif defined(ASIO_HAS_STD_ATOMIC)
typedef std::atomic<long> atomic_count;
#else // defined(ASIO_HAS_STD_ATOMIC)
typedef boost::detail::atomic_count atomic_count;
......
......@@ -17,6 +17,7 @@
#include "asio/detail/config.hpp"
#include "asio/buffer.hpp"
#include "asio/detail/array_fwd.hpp"
#include "asio/detail/socket_types.hpp"
#include "asio/detail/push_options.hpp"
......@@ -246,6 +247,112 @@ private:
std::size_t total_buffer_size_;
};
template <typename Buffer, typename Elem>
class buffer_sequence_adapter<Buffer, boost::array<Elem, 2> >
: buffer_sequence_adapter_base
{
public:
explicit buffer_sequence_adapter(
const boost::array<Elem, 2>& buffer_sequence)
{
init_native_buffer(buffers_[0], Buffer(buffer_sequence[0]));
init_native_buffer(buffers_[1], Buffer(buffer_sequence[1]));
total_buffer_size_ = asio::buffer_size(buffer_sequence[0])
+ asio::buffer_size(buffer_sequence[1]);
}
native_buffer_type* buffers()
{
return buffers_;
}
std::size_t count() const
{
return 2;
}
bool all_empty() const
{
return total_buffer_size_ == 0;
}
static bool all_empty(const boost::array<Elem, 2>& buffer_sequence)
{
return asio::buffer_size(buffer_sequence[0]) == 0
&& asio::buffer_size(buffer_sequence[1]) == 0;
}
static void validate(const boost::array<Elem, 2>& buffer_sequence)
{
asio::buffer_cast<const void*>(buffer_sequence[0]);
asio::buffer_cast<const void*>(buffer_sequence[1]);
}
static Buffer first(const boost::array<Elem, 2>& buffer_sequence)
{
return Buffer(buffer_sequence[0]);
}
private:
native_buffer_type buffers_[2];
std::size_t total_buffer_size_;
};
#if defined(ASIO_HAS_STD_ARRAY)
template <typename Buffer, typename Elem>
class buffer_sequence_adapter<Buffer, std::array<Elem, 2> >
: buffer_sequence_adapter_base
{
public:
explicit buffer_sequence_adapter(
const std::array<Elem, 2>& buffer_sequence)
{
init_native_buffer(buffers_[0], Buffer(buffer_sequence[0]));
init_native_buffer(buffers_[1], Buffer(buffer_sequence[1]));
total_buffer_size_ = asio::buffer_size(buffer_sequence[0])
+ asio::buffer_size(buffer_sequence[1]);
}
native_buffer_type* buffers()
{
return buffers_;
}
std::size_t count() const
{
return 2;
}
bool all_empty() const
{
return total_buffer_size_ == 0;
}
static bool all_empty(const std::array<Elem, 2>& buffer_sequence)
{
return asio::buffer_size(buffer_sequence[0]) == 0
&& asio::buffer_size(buffer_sequence[1]) == 0;
}
static void validate(const std::array<Elem, 2>& buffer_sequence)
{
asio::buffer_cast<const void*>(buffer_sequence[0]);
asio::buffer_cast<const void*>(buffer_sequence[1]);
}
static Buffer first(const std::array<Elem, 2>& buffer_sequence)
{
return Buffer(buffer_sequence[0]);
}
private:
native_buffer_type buffers_[2];
std::size_t total_buffer_size_;
};
#endif // defined(ASIO_HAS_STD_ARRAY)
} // namespace detail
} // namespace asio
......
......@@ -26,34 +26,60 @@ namespace detail {
// Helper class to determine whether or not the current thread is inside an
// invocation of io_service::run() for a specified io_service object.
template <typename Owner>
template <typename Key, typename Value = unsigned char>
class call_stack
{
public:
// Context class automatically pushes an owner on to the stack.
// Context class automatically pushes the key/value pair on to the stack.
class context
: private noncopyable
{
public:
// Push the owner on to the stack.
explicit context(Owner* d)
: owner_(d),
next_(call_stack<Owner>::top_)
// Push the key on to the stack.
explicit context(Key* k)
: key_(k),
next_(call_stack<Key, Value>::top_)
{
call_stack<Owner>::top_ = this;
value_ = reinterpret_cast<unsigned char*>(this);
call_stack<Key, Value>::top_ = this;
}
// Pop the owner from the stack.
// Push the key/value pair on to the stack.
context(Key* k, Value& v)
: key_(k),
value_(&v),
next_(call_stack<Key, Value>::top_)
{
call_stack<Key, Value>::top_ = this;
}
// Pop the key/value pair from the stack.
~context()
{
call_stack<Owner>::top_ = next_;
call_stack<Key, Value>::top_ = next_;
}
// Find the next context with the same key.
Value* next_by_key() const
{
context* elem = next_;
while (elem)
{
if (elem->key_ == key_)
return elem->value_;
elem = elem->next_;
}
return 0;
}
private:
friend class call_stack<Owner>;
friend class call_stack<Key, Value>;
// The key associated with the context.
Key* key_;
// The owner associated with the context.
Owner* owner_;
// The value associated with the context.
Value* value_;
// The next element in the stack.
context* next_;
......@@ -61,17 +87,18 @@ public:
friend class context;
// Determine whether the specified owner is on the stack.
static bool contains(Owner* d)
// Determine whether the specified owner is on the stack. Returns address of
// key if present, 0 otherwise.
static Value* contains(Key* k)
{
context* elem = top_;
while (elem)
{
if (elem->owner_ == d)
return true;
if (elem->key_ == k)
return elem->value_;
elem = elem->next_;
}
return false;
return 0;
}
private:
......@@ -79,9 +106,9 @@ private:
static tss_ptr<context> top_;
};
template <typename Owner>
tss_ptr<typename call_stack<Owner>::context>
call_stack<Owner>::top_;
template <typename Key, typename Value>
tss_ptr<typename call_stack<Key, Value>::context>
call_stack<Key, Value>::top_;
} // namespace detail
} // namespace asio
......
......@@ -39,7 +39,8 @@ public:
}
static void do_complete(io_service_impl* owner, operation* base,
asio::error_code /*ec*/, std::size_t /*bytes_transferred*/)
const asio::error_code& /*ec*/,
std::size_t /*bytes_transferred*/)
{
// Take ownership of the handler object.
completion_handler* h(static_cast<completion_handler*>(base));
......@@ -60,7 +61,7 @@ public:
// Make the upcall if required.
if (owner)
{
asio::detail::fenced_block b;
fenced_block b(fenced_block::half);
ASIO_HANDLER_INVOCATION_BEGIN(());
asio_handler_invoke_helpers::invoke(handler, handler);
ASIO_HANDLER_INVOCATION_END;
......
//
// detail/dependent_type.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2011 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)
//
#ifndef ASIO_DETAIL_DEPENDENT_TYPE_HPP
#define ASIO_DETAIL_DEPENDENT_TYPE_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/config.hpp"