diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/asio/detail | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/asio/detail')
84 files changed, 593 insertions, 548 deletions
diff --git a/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp index 3a9ad01..e161893 100644 --- a/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp @@ -2,7 +2,7 @@ // bind_handler.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -54,7 +54,7 @@ inline void* asio_handler_allocate(std::size_t size, binder1<Handler, Arg1>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( - size, &this_handler->handler_); + size, this_handler->handler_); } template <typename Handler, typename Arg1> @@ -62,7 +62,7 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, binder1<Handler, Arg1>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( - pointer, size, &this_handler->handler_); + pointer, size, this_handler->handler_); } template <typename Function, typename Handler, typename Arg1> @@ -70,7 +70,7 @@ inline void asio_handler_invoke(const Function& function, binder1<Handler, Arg1>* this_handler) { boost_asio_handler_invoke_helpers::invoke( - function, &this_handler->handler_); + function, this_handler->handler_); } template <typename Handler, typename Arg1> @@ -112,7 +112,7 @@ inline void* asio_handler_allocate(std::size_t size, binder2<Handler, Arg1, Arg2>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( - size, &this_handler->handler_); + size, this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2> @@ -120,7 +120,7 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, binder2<Handler, Arg1, Arg2>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( - pointer, size, &this_handler->handler_); + pointer, size, this_handler->handler_); } template <typename Function, typename Handler, typename Arg1, typename Arg2> @@ -128,7 +128,7 @@ inline void asio_handler_invoke(const Function& function, binder2<Handler, Arg1, Arg2>* this_handler) { boost_asio_handler_invoke_helpers::invoke( - function, &this_handler->handler_); + function, this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2> @@ -173,7 +173,7 @@ inline void* asio_handler_allocate(std::size_t size, binder3<Handler, Arg1, Arg2, Arg3>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( - size, &this_handler->handler_); + size, this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3> @@ -181,7 +181,7 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, binder3<Handler, Arg1, Arg2, Arg3>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( - pointer, size, &this_handler->handler_); + pointer, size, this_handler->handler_); } template <typename Function, typename Handler, typename Arg1, typename Arg2, @@ -190,7 +190,7 @@ inline void asio_handler_invoke(const Function& function, binder3<Handler, Arg1, Arg2, Arg3>* this_handler) { boost_asio_handler_invoke_helpers::invoke( - function, &this_handler->handler_); + function, this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3> @@ -239,7 +239,7 @@ inline void* asio_handler_allocate(std::size_t size, binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( - size, &this_handler->handler_); + size, this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3, @@ -248,7 +248,7 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( - pointer, size, &this_handler->handler_); + pointer, size, this_handler->handler_); } template <typename Function, typename Handler, typename Arg1, typename Arg2, @@ -257,7 +257,7 @@ inline void asio_handler_invoke(const Function& function, binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler) { boost_asio_handler_invoke_helpers::invoke( - function, &this_handler->handler_); + function, this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3, @@ -311,7 +311,7 @@ inline void* asio_handler_allocate(std::size_t size, binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( - size, &this_handler->handler_); + size, this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3, @@ -320,7 +320,7 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( - pointer, size, &this_handler->handler_); + pointer, size, this_handler->handler_); } template <typename Function, typename Handler, typename Arg1, typename Arg2, @@ -329,7 +329,7 @@ inline void asio_handler_invoke(const Function& function, binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler) { boost_asio_handler_invoke_helpers::invoke( - function, &this_handler->handler_); + function, this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3, diff --git a/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp b/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp index 63d957c..af67c46 100644 --- a/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp @@ -2,7 +2,7 @@ // buffer_resize_guard.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -18,8 +18,8 @@ #include <boost/asio/detail/push_options.hpp> #include <boost/asio/detail/push_options.hpp> -#include <limits> #include <boost/config.hpp> +#include <boost/limits.hpp> #include <boost/asio/detail/pop_options.hpp> namespace boost { diff --git a/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp b/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp index f20bf27..9b83426 100644 --- a/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp @@ -2,7 +2,7 @@ // buffered_stream_storage.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp b/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp index 0096741..0d7d52c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp @@ -2,7 +2,7 @@ // call_stack.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp b/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp index 0ed811d..bf04b1b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp @@ -2,7 +2,7 @@ // consuming_buffers.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -20,9 +20,9 @@ #include <boost/asio/detail/push_options.hpp> #include <algorithm> #include <cstddef> -#include <limits> #include <boost/config.hpp> #include <boost/iterator/iterator_facade.hpp> +#include <boost/limits.hpp> #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/buffer.hpp> diff --git a/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp b/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp index 16206a7..7885c9a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp @@ -2,7 +2,7 @@ // deadline_timer_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp b/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp index 2ee1988..c4969f7 100644 --- a/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp @@ -2,7 +2,7 @@ // descriptor_ops.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp index 8739085..7315384 100644 --- a/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp @@ -2,7 +2,7 @@ // dev_poll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -366,23 +366,26 @@ private: // Write the pending event registration changes to the /dev/poll descriptor. std::size_t events_size = sizeof(::pollfd) * pending_event_changes_.size(); - errno = 0; - int result = ::write(dev_poll_fd_, - &pending_event_changes_[0], events_size); - if (result != static_cast<int>(events_size)) + if (events_size > 0) { - for (std::size_t i = 0; i < pending_event_changes_.size(); ++i) + errno = 0; + int result = ::write(dev_poll_fd_, + &pending_event_changes_[0], events_size); + if (result != static_cast<int>(events_size)) { - int descriptor = pending_event_changes_[i].fd; - boost::system::error_code ec = boost::system::error_code( - errno, boost::asio::error::get_system_category()); - read_op_queue_.perform_all_operations(descriptor, ec); - write_op_queue_.perform_all_operations(descriptor, ec); - except_op_queue_.perform_all_operations(descriptor, ec); + for (std::size_t i = 0; i < pending_event_changes_.size(); ++i) + { + int descriptor = pending_event_changes_[i].fd; + boost::system::error_code ec = boost::system::error_code( + errno, boost::asio::error::get_system_category()); + read_op_queue_.perform_all_operations(descriptor, ec); + write_op_queue_.perform_all_operations(descriptor, ec); + except_op_queue_.perform_all_operations(descriptor, ec); + } } + pending_event_changes_.clear(); + pending_event_change_index_.clear(); } - pending_event_changes_.clear(); - pending_event_change_index_.clear(); int timeout = block ? get_timeout() : 0; wait_in_progress_ = true; @@ -399,9 +402,6 @@ private: lock.lock(); wait_in_progress_ = false; - // Block signals while performing operations. - boost::asio::detail::signal_blocker sb; - // Dispatch the waiting events. for (int i = 0; i < num_events; ++i) { @@ -435,7 +435,6 @@ private: more_writes = write_op_queue_.has_operation(descriptor); if ((events[i].events & (POLLERR | POLLHUP)) != 0 - && (events[i].events & ~(POLLERR | POLLHUP)) == 0 && !more_except && !more_reads && !more_writes) { // If we have an event and no operations associated with the diff --git a/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp index 3308575..d890fa8 100644 --- a/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp @@ -2,7 +2,7 @@ // dev_poll_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp index 2770c6a..6c6bfe3 100644 --- a/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp @@ -2,7 +2,7 @@ // epoll_reactor.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -472,9 +472,6 @@ private: lock.lock(); wait_in_progress_ = false; - // Block signals while performing operations. - boost::asio::detail::signal_blocker sb; - // Dispatch the waiting events. for (int i = 0; i < num_events; ++i) { diff --git a/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp index 567a966..9659dd4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp @@ -2,7 +2,7 @@ // epoll_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/event.hpp b/3rdParty/Boost/src/boost/asio/detail/event.hpp index 67a0118..89f9896 100644 --- a/3rdParty/Boost/src/boost/asio/detail/event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/event.hpp @@ -2,7 +2,7 @@ // event.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp index cac8405..4749ec9 100644 --- a/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp @@ -2,7 +2,7 @@ // eventfd_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Roelof Naude (roelof.naude at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -24,14 +24,14 @@ #include <boost/system/system_error.hpp> #include <boost/asio/detail/pop_options.hpp> -#if defined(linux) +#if defined(__linux__) # if !defined(BOOST_ASIO_DISABLE_EVENTFD) # include <linux/version.h> # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) # define BOOST_ASIO_HAS_EVENTFD # endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) # endif // !defined(BOOST_ASIO_DISABLE_EVENTFD) -#endif // defined(linux) +#endif // defined(__linux__) #if defined(BOOST_ASIO_HAS_EVENTFD) @@ -108,21 +108,32 @@ public: { if (write_descriptor_ == read_descriptor_) { - // Only perform one read. The kernel maintains an atomic counter. - uint64_t counter(0); - int bytes_read = ::read(read_descriptor_, &counter, sizeof(uint64_t)); - bool was_interrupted = (bytes_read > 0); - return was_interrupted; + for (;;) + { + // Only perform one read. The kernel maintains an atomic counter. + uint64_t counter(0); + errno = 0; + int bytes_read = ::read(read_descriptor_, &counter, sizeof(uint64_t)); + if (bytes_read < 0 && errno == EINTR) + continue; + bool was_interrupted = (bytes_read > 0); + return was_interrupted; + } } else { - // Clear all data from the pipe. - char data[1024]; - int bytes_read = ::read(read_descriptor_, data, sizeof(data)); - bool was_interrupted = (bytes_read > 0); - while (bytes_read == sizeof(data)) - bytes_read = ::read(read_descriptor_, data, sizeof(data)); - return was_interrupted; + for (;;) + { + // Clear all data from the pipe. + char data[1024]; + int bytes_read = ::read(read_descriptor_, data, sizeof(data)); + if (bytes_read < 0 && errno == EINTR) + continue; + bool was_interrupted = (bytes_read > 0); + while (bytes_read == sizeof(data)) + bytes_read = ::read(read_descriptor_, data, sizeof(data)); + return was_interrupted; + } } } diff --git a/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp b/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp index 3fff01e..059362e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp @@ -2,7 +2,7 @@ // fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp index bfc918b..d385972 100644 --- a/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp @@ -2,7 +2,7 @@ // handler_alloc_helpers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -19,6 +19,7 @@ #include <boost/asio/detail/push_options.hpp> #include <boost/detail/workaround.hpp> +#include <boost/utility/addressof.hpp> #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/handler_alloc_hook.hpp> @@ -30,24 +31,26 @@ namespace boost_asio_handler_alloc_helpers { template <typename Handler> -inline void* allocate(std::size_t s, Handler* h) +inline void* allocate(std::size_t s, Handler& h) { -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \ + || BOOST_WORKAROUND(__GNUC__, < 3) return ::operator new(s); #else using namespace boost::asio; - return asio_handler_allocate(s, h); + return asio_handler_allocate(s, boost::addressof(h)); #endif } template <typename Handler> -inline void deallocate(void* p, std::size_t s, Handler* h) +inline void deallocate(void* p, std::size_t s, Handler& h) { -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \ + || BOOST_WORKAROUND(__GNUC__, < 3) ::operator delete(p); #else using namespace boost::asio; - asio_handler_deallocate(p, s, h); + asio_handler_deallocate(p, s, boost::addressof(h)); #endif } @@ -85,7 +88,7 @@ public: raw_handler_ptr(handler_type& handler) : handler_(handler), pointer_(static_cast<pointer_type>( - boost_asio_handler_alloc_helpers::allocate(value_size, &handler_))) + boost_asio_handler_alloc_helpers::allocate(value_size, handler_))) { } @@ -95,7 +98,7 @@ public: { if (pointer_) boost_asio_handler_alloc_helpers::deallocate( - pointer_, value_size, &handler_); + pointer_, value_size, handler_); } private: @@ -239,7 +242,7 @@ public: { pointer_->value_type::~value_type(); boost_asio_handler_alloc_helpers::deallocate( - pointer_, value_size, &handler_); + pointer_, value_size, handler_); pointer_ = 0; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/handler_base_from_member.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_base_from_member.hpp index 4bd95ed..4e471e3 100644 --- a/3rdParty/Boost/src/boost/asio/detail/handler_base_from_member.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/handler_base_from_member.hpp @@ -2,7 +2,7 @@ // handler_base_from_member.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -50,7 +50,7 @@ inline void* asio_handler_allocate(std::size_t size, handler_base_from_member<Handler>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( - size, &this_handler->handler_); + size, this_handler->handler_); } template <typename Handler> @@ -58,7 +58,7 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, handler_base_from_member<Handler>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( - pointer, size, &this_handler->handler_); + pointer, size, this_handler->handler_); } template <typename Function, typename Handler> @@ -66,7 +66,7 @@ inline void asio_handler_invoke(const Function& function, handler_base_from_member<Handler>* this_handler) { boost_asio_handler_invoke_helpers::invoke( - function, &this_handler->handler_); + function, this_handler->handler_); } } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp index 4da384a..8952d8d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp @@ -2,7 +2,7 @@ // handler_invoke_helpers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -19,6 +19,7 @@ #include <boost/asio/detail/push_options.hpp> #include <boost/detail/workaround.hpp> +#include <boost/utility/addressof.hpp> #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/handler_invoke_hook.hpp> @@ -29,14 +30,15 @@ namespace boost_asio_handler_invoke_helpers { template <typename Function, typename Context> -inline void invoke(const Function& function, Context* context) +inline void invoke(const Function& function, Context& context) { -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \ + || BOOST_WORKAROUND(__GNUC__, < 3) Function tmp(function); tmp(); #else using namespace boost::asio; - asio_handler_invoke(function, context); + asio_handler_invoke(function, boost::addressof(context)); #endif } diff --git a/3rdParty/Boost/src/boost/asio/detail/handler_queue.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_queue.hpp index ccc1b0c..c1fb988 100644 --- a/3rdParty/Boost/src/boost/asio/detail/handler_queue.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/handler_queue.hpp @@ -2,7 +2,7 @@ // handler_queue.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -189,7 +189,7 @@ private: ptr.reset(); // Make the upcall. - boost_asio_handler_invoke_helpers::invoke(handler, &handler); + boost_asio_handler_invoke_helpers::invoke(handler, handler); } static void do_destroy(handler* base) diff --git a/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp b/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp index 923ae57..c620da7 100644 --- a/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp @@ -2,7 +2,7 @@ // hash_map.hpp // ~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -215,6 +215,9 @@ private: // Re-initialise the hash from the values already contained in the list. void rehash(std::size_t num_buckets) { + if (num_buckets == buckets_.size()) + return; + iterator end = values_.end(); // Update number of buckets and initialise all buckets to empty. @@ -231,9 +234,13 @@ private: { buckets_[bucket].first = buckets_[bucket].last = iter++; } + else if (++buckets_[bucket].last == iter) + { + ++iter; + } else { - values_.splice(++buckets_[bucket].last, values_, iter++); + values_.splice(buckets_[bucket].last, values_, iter++); --buckets_[bucket].last; } } @@ -275,6 +282,8 @@ private: // The type for a bucket in the hash table. struct bucket_type { + bucket_type() {} + bucket_type(const bucket_type&) { /* noop */ } iterator first; iterator last; }; diff --git a/3rdParty/Boost/src/boost/asio/detail/indirect_handler_queue.hpp b/3rdParty/Boost/src/boost/asio/detail/indirect_handler_queue.hpp index 2775078..72b1030 100644 --- a/3rdParty/Boost/src/boost/asio/detail/indirect_handler_queue.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/indirect_handler_queue.hpp @@ -2,7 +2,7 @@ // indirect_handler_queue.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -236,7 +236,7 @@ private: ptr.reset(); // Make the upcall. - boost_asio_handler_invoke_helpers::invoke(handler, &handler); + boost_asio_handler_invoke_helpers::invoke(handler, handler); } static void do_destroy(handler* base) diff --git a/3rdParty/Boost/src/boost/asio/detail/io_control.hpp b/3rdParty/Boost/src/boost/asio/detail/io_control.hpp index 6730dc3..5021c2e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/io_control.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/io_control.hpp @@ -2,7 +2,7 @@ // io_control.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp index 179b7d4..ea8e285 100644 --- a/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp @@ -2,7 +2,7 @@ // kqueue_reactor.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -442,9 +442,6 @@ private: lock.lock(); wait_in_progress_ = false; - // Block signals while performing operations. - boost::asio::detail::signal_blocker sb; - // Dispatch the waiting events. for (int i = 0; i < num_events; ++i) { diff --git a/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp index e3df284..b2751bf 100644 --- a/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp @@ -2,7 +2,7 @@ // kqueue_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -19,9 +19,11 @@ #include <boost/asio/detail/push_options.hpp> #if !defined(BOOST_ASIO_DISABLE_KQUEUE) -#if defined(__MACH__) && defined(__APPLE__) -// Define this to indicate that epoll is supported on the target platform. +#if (defined(__MACH__) && defined(__APPLE__)) \ + || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) + +// Define this to indicate that kqueue is supported on the target platform. #define BOOST_ASIO_HAS_KQUEUE 1 namespace boost { @@ -35,7 +37,9 @@ class kqueue_reactor; } // namespace asio } // namespace boost -#endif // defined(__MACH__) && defined(__APPLE__) +#endif // (defined(__MACH__) && defined(__APPLE__)) + // || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) + #endif // !defined(BOOST_ASIO_DISABLE_KQUEUE) #include <boost/asio/detail/pop_options.hpp> diff --git a/3rdParty/Boost/src/boost/asio/detail/mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/mutex.hpp index 4f64a28..fc7ed83 100644 --- a/3rdParty/Boost/src/boost/asio/detail/mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/mutex.hpp @@ -2,7 +2,7 @@ // mutex.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp b/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp index 3a09538..b3a6e7c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp @@ -2,7 +2,7 @@ // noncopyable.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/null_event.hpp b/3rdParty/Boost/src/boost/asio/detail/null_event.hpp index 4b667e7..184f753 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_event.hpp @@ -2,7 +2,7 @@ // null_event.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp index 64bf871..bdf5617 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp @@ -2,7 +2,7 @@ // null_mutex.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp b/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp index 1fc65c8..7fe5c10 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp @@ -2,7 +2,7 @@ // null_signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp index 5aed211..0a508f3 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp @@ -2,7 +2,7 @@ // null_thread.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp index ba4b8f8..7c35b15 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp @@ -2,7 +2,7 @@ // null_tss_ptr.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp b/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp index 5f0aba1..5f84182 100644 --- a/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp @@ -2,7 +2,7 @@ // old_win_sdk_compat.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp index 51b8c02..7f9e122 100644 --- a/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp @@ -2,7 +2,7 @@ // pipe_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -79,12 +79,17 @@ public: // Reset the select interrupt. Returns true if the call was interrupted. bool reset() { - char data[1024]; - int bytes_read = ::read(read_descriptor_, data, sizeof(data)); - bool was_interrupted = (bytes_read > 0); - while (bytes_read == sizeof(data)) - bytes_read = ::read(read_descriptor_, data, sizeof(data)); - return was_interrupted; + for (;;) + { + char data[1024]; + int bytes_read = ::read(read_descriptor_, data, sizeof(data)); + if (bytes_read < 0 && errno == EINTR) + continue; + bool was_interrupted = (bytes_read > 0); + while (bytes_read == sizeof(data)) + bytes_read = ::read(read_descriptor_, data, sizeof(data)); + return was_interrupted; + } } // Get the read descriptor to be passed to select. diff --git a/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp b/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp index 7f56662..a26b203 100644 --- a/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp @@ -2,7 +2,7 @@ // pop_options.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp index f838342..20c0fe3 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp @@ -2,7 +2,7 @@ // posix_event.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp index 121b396..09fc28d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp @@ -2,7 +2,7 @@ // posix_fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp index 219d6d0..e7209c1 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp @@ -2,7 +2,7 @@ // posix_mutex.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp index f8234fb..aebe39b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp @@ -2,7 +2,7 @@ // posix_signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp index 1e38618..41d8bc9 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp @@ -2,7 +2,7 @@ // posix_thread.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -37,7 +37,7 @@ namespace boost { namespace asio { namespace detail { -extern "C" void* asio_detail_posix_thread_function(void* arg); +extern "C" void* boost_asio_detail_posix_thread_function(void* arg); class posix_thread : private noncopyable @@ -50,7 +50,7 @@ public: { std::auto_ptr<func_base> arg(new func<Function>(f)); int error = ::pthread_create(&thread_, 0, - asio_detail_posix_thread_function, arg.get()); + boost_asio_detail_posix_thread_function, arg.get()); if (error != 0) { boost::system::system_error e( @@ -80,7 +80,7 @@ public: } private: - friend void* asio_detail_posix_thread_function(void* arg); + friend void* boost_asio_detail_posix_thread_function(void* arg); class func_base { @@ -112,7 +112,7 @@ private: bool joined_; }; -inline void* asio_detail_posix_thread_function(void* arg) +inline void* boost_asio_detail_posix_thread_function(void* arg) { std::auto_ptr<posix_thread::func_base> f( static_cast<posix_thread::func_base*>(arg)); diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp index f53c2dc..c83df96 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp @@ -2,7 +2,7 @@ // posix_tss_ptr.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/push_options.hpp b/3rdParty/Boost/src/boost/asio/detail/push_options.hpp index 47524b2..cb0e902 100644 --- a/3rdParty/Boost/src/boost/asio/detail/push_options.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/push_options.hpp @@ -2,7 +2,7 @@ // push_options.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp index ad828aa..61f676b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp @@ -2,7 +2,7 @@ // reactive_descriptor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -348,16 +348,23 @@ public: boost::asio::buffer_size(buffer)); } - // Write the data. - int bytes = descriptor_ops::gather_write(descriptor_, bufs, i, ec); + for (;;) + { + // Write the data. + int bytes = descriptor_ops::gather_write(descriptor_, bufs, i, ec); - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - return false; + // Retry operation if interrupted by signal. + if (ec == boost::asio::error::interrupted) + continue; - bytes_transferred = (bytes < 0 ? 0 : bytes); - return true; + // Check if we need to run the operation again. + if (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again) + return false; + + bytes_transferred = (bytes < 0 ? 0 : bytes); + return true; + } } void complete(const boost::system::error_code& ec, @@ -600,18 +607,25 @@ public: boost::asio::buffer_size(buffer)); } - // Read some data. - int bytes = descriptor_ops::scatter_read(descriptor_, bufs, i, ec); - if (bytes == 0) - ec = boost::asio::error::eof; + for (;;) + { + // Read some data. + int bytes = descriptor_ops::scatter_read(descriptor_, bufs, i, ec); + if (bytes == 0) + ec = boost::asio::error::eof; - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - return false; + // Retry operation if interrupted by signal. + if (ec == boost::asio::error::interrupted) + continue; - bytes_transferred = (bytes < 0 ? 0 : bytes); - return true; + // Check if we need to run the operation again. + if (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again) + return false; + + bytes_transferred = (bytes < 0 ? 0 : bytes); + return true; + } } void complete(const boost::system::error_code& ec, diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp index 0beff14..cd163e9 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp @@ -2,7 +2,7 @@ // reactive_serial_port_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp index 54b8cbd..95d39dd 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp @@ -2,7 +2,7 @@ // reactive_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -275,12 +275,21 @@ public: return false; } +#if defined(SIOCATMARK) boost::asio::detail::ioctl_arg_type value = 0; socket_ops::ioctl(impl.socket_, SIOCATMARK, &value, ec); -#if defined(ENOTTY) +# if defined(ENOTTY) if (ec.value() == ENOTTY) ec = boost::asio::error::not_socket; -#endif // defined(ENOTTY) +# endif // defined(ENOTTY) +#else // defined(SIOCATMARK) + int value = sockatmark(impl.socket_); + if (value == -1) + ec = boost::system::error_code(errno, + boost::asio::error::get_system_category()); + else + ec = boost::system::error_code(); +#endif // defined(SIOCATMARK) return ec ? false : value != 0; } @@ -644,16 +653,23 @@ public: boost::asio::buffer_size(buffer)); } - // Send the data. - int bytes = socket_ops::send(socket_, bufs, i, flags_, ec); + for (;;) + { + // Send the data. + int bytes = socket_ops::send(socket_, bufs, i, flags_, ec); - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - return false; + // Retry operation if interrupted by signal. + if (ec == boost::asio::error::interrupted) + continue; - bytes_transferred = (bytes < 0 ? 0 : bytes); - return true; + // Check if we need to run the operation again. + if (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again) + return false; + + bytes_transferred = (bytes < 0 ? 0 : bytes); + return true; + } } void complete(const boost::system::error_code& ec, @@ -881,17 +897,24 @@ public: boost::asio::buffer_size(buffer)); } - // Send the data. - int bytes = socket_ops::sendto(socket_, bufs, i, flags_, - destination_.data(), destination_.size(), ec); + for (;;) + { + // Send the data. + int bytes = socket_ops::sendto(socket_, bufs, i, flags_, + destination_.data(), destination_.size(), ec); - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - return false; + // Retry operation if interrupted by signal. + if (ec == boost::asio::error::interrupted) + continue; - bytes_transferred = (bytes < 0 ? 0 : bytes); - return true; + // Check if we need to run the operation again. + if (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again) + return false; + + bytes_transferred = (bytes < 0 ? 0 : bytes); + return true; + } } void complete(const boost::system::error_code& ec, @@ -1086,18 +1109,25 @@ public: boost::asio::buffer_size(buffer)); } - // Receive some data. - int bytes = socket_ops::recv(socket_, bufs, i, flags_, ec); - if (bytes == 0 && protocol_type_ == SOCK_STREAM) - ec = boost::asio::error::eof; + for (;;) + { + // Receive some data. + int bytes = socket_ops::recv(socket_, bufs, i, flags_, ec); + if (bytes == 0 && protocol_type_ == SOCK_STREAM) + ec = boost::asio::error::eof; - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - return false; + // Retry operation if interrupted by signal. + if (ec == boost::asio::error::interrupted) + continue; - bytes_transferred = (bytes < 0 ? 0 : bytes); - return true; + // Check if we need to run the operation again. + if (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again) + return false; + + bytes_transferred = (bytes < 0 ? 0 : bytes); + return true; + } } void complete(const boost::system::error_code& ec, @@ -1331,21 +1361,28 @@ public: boost::asio::buffer_size(buffer)); } - // Receive some data. - std::size_t addr_len = sender_endpoint_.capacity(); - int bytes = socket_ops::recvfrom(socket_, bufs, i, flags_, - sender_endpoint_.data(), &addr_len, ec); - if (bytes == 0 && protocol_type_ == SOCK_STREAM) - ec = boost::asio::error::eof; - - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - return false; - - sender_endpoint_.resize(addr_len); - bytes_transferred = (bytes < 0 ? 0 : bytes); - return true; + for (;;) + { + // Receive some data. + std::size_t addr_len = sender_endpoint_.capacity(); + int bytes = socket_ops::recvfrom(socket_, bufs, i, flags_, + sender_endpoint_.data(), &addr_len, ec); + if (bytes == 0 && protocol_type_ == SOCK_STREAM) + ec = boost::asio::error::eof; + + // Retry operation if interrupted by signal. + if (ec == boost::asio::error::interrupted) + continue; + + // Check if we need to run the operation again. + if (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again) + return false; + + sender_endpoint_.resize(addr_len); + bytes_transferred = (bytes < 0 ? 0 : bytes); + return true; + } } void complete(const boost::system::error_code& ec, @@ -1454,7 +1491,6 @@ public: for (;;) { // Try to complete the operation without blocking. - boost::system::error_code ec; socket_holder new_socket; std::size_t addr_len = 0; if (peer_endpoint) @@ -1536,43 +1572,50 @@ public: if (ec) return true; - // Accept the waiting connection. - socket_holder new_socket; - std::size_t addr_len = 0; - if (peer_endpoint_) + for (;;) { - addr_len = peer_endpoint_->capacity(); - new_socket.reset(socket_ops::accept(socket_, - peer_endpoint_->data(), &addr_len, ec)); - } - else - { - new_socket.reset(socket_ops::accept(socket_, 0, 0, ec)); - } + // Accept the waiting connection. + socket_holder new_socket; + std::size_t addr_len = 0; + if (peer_endpoint_) + { + addr_len = peer_endpoint_->capacity(); + new_socket.reset(socket_ops::accept(socket_, + peer_endpoint_->data(), &addr_len, ec)); + } + else + { + new_socket.reset(socket_ops::accept(socket_, 0, 0, ec)); + } - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - return false; - if (ec == boost::asio::error::connection_aborted - && !enable_connection_aborted_) - return false; + // Retry operation if interrupted by signal. + if (ec == boost::asio::error::interrupted) + continue; + + // Check if we need to run the operation again. + if (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again) + return false; + if (ec == boost::asio::error::connection_aborted + && !enable_connection_aborted_) + return false; #if defined(EPROTO) - if (ec.value() == EPROTO && !enable_connection_aborted_) - return false; + if (ec.value() == EPROTO && !enable_connection_aborted_) + return false; #endif // defined(EPROTO) - // Transfer ownership of the new socket to the peer object. - if (!ec) - { - if (peer_endpoint_) - peer_endpoint_->resize(addr_len); - peer_.assign(protocol_, new_socket.get(), ec); + // Transfer ownership of the new socket to the peer object. if (!ec) - new_socket.release(); - } + { + if (peer_endpoint_) + peer_endpoint_->resize(addr_len); + peer_.assign(protocol_, new_socket.get(), ec); + if (!ec) + new_socket.release(); + } - return true; + return true; + } } void complete(const boost::system::error_code& ec, std::size_t) diff --git a/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp b/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp index 0fbbf23..46f0c10 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp @@ -2,7 +2,7 @@ // reactor_op_queue.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp b/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp index 9b0aac9..3270cd6 100644 --- a/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp @@ -2,7 +2,7 @@ // resolver_service.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp b/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp index 1dd2842..c319263 100644 --- a/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp @@ -2,7 +2,7 @@ // scoped_lock.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp index 8bb952c..f844881 100644 --- a/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp @@ -2,7 +2,7 @@ // select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -21,9 +21,12 @@ #include <boost/config.hpp> #include <boost/asio/detail/pop_options.hpp> -#include <boost/asio/detail/eventfd_select_interrupter.hpp> -#include <boost/asio/detail/pipe_select_interrupter.hpp> -#include <boost/asio/detail/socket_select_interrupter.hpp> +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) +# include <boost/asio/detail/socket_select_interrupter.hpp> +#else +# include <boost/asio/detail/eventfd_select_interrupter.hpp> +# include <boost/asio/detail/pipe_select_interrupter.hpp> +#endif namespace boost { namespace asio { diff --git a/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp index 77caf54..ba8b5d3 100644 --- a/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp @@ -2,7 +2,7 @@ // select_reactor.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -369,9 +369,6 @@ private: lock.lock(); select_in_progress_ = false; - // Block signals while dispatching operations. - boost::asio::detail::signal_blocker sb; - // Reset the interrupter. if (retval > 0 && read_fds.is_set(interrupter_.read_descriptor())) interrupter_.reset(); diff --git a/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp index 3bd5d86..b48e0f0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp @@ -2,7 +2,7 @@ // select_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/service_base.hpp b/3rdParty/Boost/src/boost/asio/detail/service_base.hpp index f01cdaf..66c2af3 100644 --- a/3rdParty/Boost/src/boost/asio/detail/service_base.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/service_base.hpp @@ -2,7 +2,7 @@ // service_base.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/service_id.hpp b/3rdParty/Boost/src/boost/asio/detail/service_id.hpp index f249ddf..ac0f4d1 100644 --- a/3rdParty/Boost/src/boost/asio/detail/service_id.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/service_id.hpp @@ -2,7 +2,7 @@ // service_id.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp b/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp index 6b25663..b648939 100644 --- a/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp @@ -2,7 +2,7 @@ // service_registry.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp index e32647b..4031b1a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp @@ -2,7 +2,7 @@ // service_registry_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp index a770549..db11fe4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp @@ -2,7 +2,7 @@ // signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp index e5a3d37..50e06b8 100644 --- a/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp @@ -2,7 +2,7 @@ // signal_init.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp index be144a6..5d6012b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp @@ -2,7 +2,7 @@ // socket_holder.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp index 4969017..475162a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp @@ -2,7 +2,7 @@ // socket_ops.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -1388,8 +1388,9 @@ inline int gai_echeck(const char* host, const char* service, break; case AF_INET: case AF_INET6: - if (socktype != 0 && socktype != SOCK_STREAM && socktype != SOCK_DGRAM) - return EAI_SOCKTYPE; + if (service != 0 && service[0] != '\0') + if (socktype != 0 && socktype != SOCK_STREAM && socktype != SOCK_DGRAM) + return EAI_SOCKTYPE; break; default: return EAI_FAMILY; diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp index c0d7b74..e31aae4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp @@ -2,7 +2,7 @@ // socket_option.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -21,6 +21,7 @@ #include <cstddef> #include <stdexcept> #include <boost/config.hpp> +#include <boost/throw_exception.hpp> #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/detail/socket_types.hpp> @@ -122,7 +123,10 @@ public: case sizeof(value_): break; default: - throw std::length_error("boolean socket option resize"); + { + std::length_error ex("boolean socket option resize"); + boost::throw_exception(ex); + } } } @@ -200,7 +204,10 @@ public: void resize(const Protocol&, std::size_t s) { if (s != sizeof(value_)) - throw std::length_error("integer socket option resize"); + { + std::length_error ex("integer socket option resize"); + boost::throw_exception(ex); + } } private: @@ -294,7 +301,10 @@ public: void resize(const Protocol&, std::size_t s) { if (s != sizeof(value_)) - throw std::length_error("linger socket option resize"); + { + std::length_error ex("linger socket option resize"); + boost::throw_exception(ex); + } } private: diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp index a767ba0..a538ae5 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp @@ -2,7 +2,7 @@ // socket_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -72,6 +72,11 @@ public: boost::throw_exception(e); } + // Some broken firewalls on Windows will intermittently cause getsockname to + // return 0.0.0.0 when the socket is actually bound to 127.0.0.1. We + // explicitly specify the target address here to work around this problem. + addr.sin_addr.s_addr = inet_addr("127.0.0.1"); + if (socket_ops::listen(acceptor.get(), SOMAXCONN, ec) == socket_error_retval) { diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp index c7b6a75..7395ee4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp @@ -2,7 +2,7 @@ // socket_types.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -163,7 +163,11 @@ typedef int socket_type; const int invalid_socket = -1; const int socket_error_retval = -1; const int max_addr_v4_str_len = INET_ADDRSTRLEN; +#if defined(INET6_ADDRSTRLEN) const int max_addr_v6_str_len = INET6_ADDRSTRLEN + 1 + IF_NAMESIZE; +#else // defined(INET6_ADDRSTRLEN) +const int max_addr_v6_str_len = 256; +#endif // defined(INET6_ADDRSTRLEN) typedef sockaddr socket_addr_type; typedef in_addr in4_addr_type; # if defined(__hpux) diff --git a/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp b/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp index 2c89a61..b228cec 100644 --- a/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp @@ -2,7 +2,7 @@ // strand_service.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -20,8 +20,8 @@ #include <boost/asio/detail/push_options.hpp> #include <boost/aligned_storage.hpp> #include <boost/assert.hpp> -#include <boost/detail/atomic_count.hpp> -#include <boost/intrusive_ptr.hpp> +#include <boost/functional/hash.hpp> +#include <boost/scoped_ptr.hpp> #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/io_service.hpp> @@ -49,20 +49,12 @@ public: // The underlying implementation of a strand. class strand_impl { -#if defined (__BORLANDC__) public: -#else - private: -#endif - void add_ref() - { - ++ref_count_; - } - - void release() + strand_impl() + : current_handler_(0), + first_waiter_(0), + last_waiter_(0) { - if (--ref_count_ == 0) - delete this; } private: @@ -71,55 +63,9 @@ public: friend class post_next_waiter_on_exit; friend class invoke_current_handler; - strand_impl(strand_service& owner) - : owner_(owner), - current_handler_(0), - first_waiter_(0), - last_waiter_(0), - ref_count_(0) - { - // Insert implementation into linked list of all implementations. - boost::asio::detail::mutex::scoped_lock lock(owner_.mutex_); - next_ = owner_.impl_list_; - prev_ = 0; - if (owner_.impl_list_) - owner_.impl_list_->prev_ = this; - owner_.impl_list_ = this; - } - - ~strand_impl() - { - // Remove implementation from linked list of all implementations. - boost::asio::detail::mutex::scoped_lock lock(owner_.mutex_); - if (owner_.impl_list_ == this) - owner_.impl_list_ = next_; - if (prev_) - prev_->next_ = next_; - if (next_) - next_->prev_= prev_; - next_ = 0; - prev_ = 0; - lock.unlock(); - - if (current_handler_) - { - current_handler_->destroy(); - } - - while (first_waiter_) - { - handler_base* next = first_waiter_->next_; - first_waiter_->destroy(); - first_waiter_ = next; - } - } - // Mutex to protect access to internal data. boost::asio::detail::mutex mutex_; - // The service that owns this implementation. - strand_service& owner_; - // The handler that is ready to execute. If this pointer is non-null then it // indicates that a handler holds the lock. handler_base* current_handler_; @@ -137,30 +83,11 @@ public: #else handler_storage_type handler_storage_; #endif - - // Pointers to adjacent socket implementations in linked list. - strand_impl* next_; - strand_impl* prev_; - - // The reference count on the strand implementation. - boost::detail::atomic_count ref_count_; - -#if !defined(__BORLANDC__) - friend void intrusive_ptr_add_ref(strand_impl* p) - { - p->add_ref(); - } - - friend void intrusive_ptr_release(strand_impl* p) - { - p->release(); - } -#endif }; friend class strand_impl; - typedef boost::intrusive_ptr<strand_impl> implementation_type; + typedef strand_impl* implementation_type; // Base class for all handler types. class handler_base @@ -328,10 +255,10 @@ public: ptr.reset(); // Indicate that this strand is executing on the current thread. - call_stack<strand_impl>::context ctx(impl.get()); + call_stack<strand_impl>::context ctx(impl); // Make the upcall. - boost_asio_handler_invoke_helpers::invoke(handler, &handler); + boost_asio_handler_invoke_helpers::invoke(handler, handler); } static void do_destroy(handler_base* base) @@ -361,7 +288,7 @@ public: explicit strand_service(boost::asio::io_service& io_service) : boost::asio::detail::service_base<strand_service>(io_service), mutex_(), - impl_list_(0) + salt_(0) { } @@ -370,24 +297,25 @@ public: { // Construct a list of all handlers to be destroyed. boost::asio::detail::mutex::scoped_lock lock(mutex_); - strand_impl* impl = impl_list_; handler_base* first_handler = 0; - while (impl) + for (std::size_t i = 0; i < num_implementations; ++i) { - if (impl->current_handler_) + if (strand_impl* impl = implementations_[i].get()) { - impl->current_handler_->next_ = first_handler; - first_handler = impl->current_handler_; - impl->current_handler_ = 0; - } - if (impl->first_waiter_) - { - impl->last_waiter_->next_ = first_handler; - first_handler = impl->first_waiter_; - impl->first_waiter_ = 0; - impl->last_waiter_ = 0; + if (impl->current_handler_) + { + impl->current_handler_->next_ = first_handler; + first_handler = impl->current_handler_; + impl->current_handler_ = 0; + } + if (impl->first_waiter_) + { + impl->last_waiter_->next_ = first_handler; + first_handler = impl->first_waiter_; + impl->first_waiter_ = 0; + impl->last_waiter_ = 0; + } } - impl = impl->next_; } // Destroy all handlers without holding the lock. @@ -403,22 +331,30 @@ public: // Construct a new strand implementation. void construct(implementation_type& impl) { - impl = implementation_type(new strand_impl(*this)); + std::size_t index = boost::hash_value(&impl); + boost::hash_combine(index, salt_++); + index = index % num_implementations; + + boost::asio::detail::mutex::scoped_lock lock(mutex_); + + if (!implementations_[index]) + implementations_[index].reset(new strand_impl); + impl = implementations_[index].get(); } // Destroy a strand implementation. void destroy(implementation_type& impl) { - implementation_type().swap(impl); + impl = 0; } // Request the io_service to invoke the given handler. template <typename Handler> void dispatch(implementation_type& impl, Handler handler) { - if (call_stack<strand_impl>::contains(impl.get())) + if (call_stack<strand_impl>::contains(impl)) { - boost_asio_handler_invoke_helpers::invoke(handler, &handler); + boost_asio_handler_invoke_helpers::invoke(handler, handler); } else { @@ -496,37 +432,24 @@ public: } private: - // Mutex to protect access to the linked list of implementations. + // Mutex to protect access to the array of implementations. boost::asio::detail::mutex mutex_; + // Number of implementations shared between all strand objects. + enum { num_implementations = 193 }; + // The head of a linked list of all implementations. - strand_impl* impl_list_; + boost::scoped_ptr<strand_impl> implementations_[num_implementations]; + + // Extra value used when hashing to prevent recycled memory locations from + // getting the same strand implementation. + std::size_t salt_; }; } // namespace detail } // namespace asio } // namespace boost -#if defined(__BORLANDC__) - -namespace boost { - -inline void intrusive_ptr_add_ref( - boost::asio::detail::strand_service::strand_impl* p) -{ - p->add_ref(); -} - -inline void intrusive_ptr_release( - boost::asio::detail::strand_service::strand_impl* p) -{ - p->release(); -} - -} // namespace boost - -#endif // defined(__BORLANDC__) - #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_STRAND_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp b/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp index eeae6b0..ddfea72 100644 --- a/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp @@ -2,7 +2,7 @@ // task_io_service.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -177,7 +177,7 @@ public: void dispatch(Handler handler) { if (call_stack<task_io_service>::contains(this)) - boost_asio_handler_invoke_helpers::invoke(handler, &handler); + boost_asio_handler_invoke_helpers::invoke(handler, handler); else post(handler); } diff --git a/3rdParty/Boost/src/boost/asio/detail/task_io_service_2lock.hpp b/3rdParty/Boost/src/boost/asio/detail/task_io_service_2lock.hpp index bd406cb..71bceef 100644 --- a/3rdParty/Boost/src/boost/asio/detail/task_io_service_2lock.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/task_io_service_2lock.hpp @@ -2,7 +2,7 @@ // task_io_service_2lock.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -50,7 +50,7 @@ public: : boost::asio::detail::service_base<task_io_service<Task> >(io_service), front_mutex_(), back_mutex_(), - task_(&use_service<Task>(io_service)), + task_(0), outstanding_work_(0), front_stopped_(false), back_stopped_(false), @@ -207,7 +207,7 @@ public: void dispatch(Handler handler) { if (call_stack<task_io_service>::contains(this)) - boost_asio_handler_invoke_helpers::invoke(handler, &handler); + boost_asio_handler_invoke_helpers::invoke(handler, handler); else post(handler); } diff --git a/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp index 6dc8955..60a0790 100644 --- a/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp @@ -2,7 +2,7 @@ // task_io_service_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/thread.hpp b/3rdParty/Boost/src/boost/asio/detail/thread.hpp index 3db5805..24a7a8c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/thread.hpp @@ -2,7 +2,7 @@ // thread.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp b/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp index 0786c40..e9406a7 100644 --- a/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp @@ -2,7 +2,7 @@ // throw_error.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp index f5370e5..35c8a77 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp @@ -2,7 +2,7 @@ // timer_queue.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -20,10 +20,10 @@ #include <boost/asio/detail/push_options.hpp> #include <cstddef> #include <functional> -#include <limits> #include <memory> #include <vector> #include <boost/config.hpp> +#include <boost/limits.hpp> #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/error.hpp> @@ -67,8 +67,10 @@ public: heap_.reserve(heap_.size() + 1); // Create a new timer object. - std::auto_ptr<timer<Handler> > new_timer( - new timer<Handler>(time, handler, token)); + typedef timer<Handler> timer_type; + typedef handler_alloc_traits<Handler, timer_type> alloc_traits; + raw_handler_ptr<alloc_traits> raw_ptr(handler); + handler_ptr<alloc_traits> new_timer(raw_ptr, time, handler, token); // Insert the new timer into the hash. typedef typename hash_map<void*, timer_base*>::iterator iterator; @@ -78,12 +80,12 @@ public: if (!result.second) { result.first->second->prev_ = new_timer.get(); - new_timer->next_ = result.first->second; + new_timer.get()->next_ = result.first->second; result.first->second = new_timer.get(); } // Put the timer at the correct position in the heap. - new_timer->heap_index_ = heap_.size(); + new_timer.get()->heap_index_ = heap_.size(); heap_.push_back(new_timer.get()); up_heap(heap_.size() - 1); bool is_first = (heap_[0] == new_timer.get()); diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp index 1d986c0..cd6a0d3 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp @@ -2,7 +2,7 @@ // timer_queue_base.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp index 2cfd641..9af4965 100644 --- a/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp @@ -2,7 +2,7 @@ // tss_ptr.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/win_event.hpp b/3rdParty/Boost/src/boost/asio/detail/win_event.hpp index d0a135e..637b580 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_event.hpp @@ -2,7 +2,7 @@ // win_event.hpp // ~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp b/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp index 9127a41..11c1e15 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp @@ -2,7 +2,7 @@ // win_fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp index fd204de..6998d57 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp @@ -2,7 +2,7 @@ // win_iocp_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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 @@ -357,6 +357,7 @@ public: DWORD last_error = ::GetLastError(); ec = boost::system::error_code(last_error, boost::asio::error::get_system_category()); + return 0; } ec = boost::system::error_code(); @@ -414,7 +415,7 @@ public: boost::system::error_code ec(last_error, boost::asio::error::get_system_category()); boost_asio_handler_invoke_helpers::invoke( - bind_handler(handler, ec, bytes_transferred), &handler); + bind_handler(handler, ec, bytes_transferred), handler); } static void destroy_impl(operation* op) @@ -456,13 +457,6 @@ public: void async_write_some_at(implementation_type& impl, boost::uint64_t offset, const ConstBufferSequence& buffers, Handler handler) { - if (!is_open(impl)) - { - this->get_io_service().post(bind_handler(handler, - boost::asio::error::bad_descriptor, 0)); - return; - } - // Update the ID of the thread from which cancellation is safe. if (impl.safe_cancellation_thread_id_ == 0) impl.safe_cancellation_thread_id_ = ::GetCurrentThreadId(); @@ -475,6 +469,13 @@ public: raw_handler_ptr<alloc_traits> raw_ptr(handler); handler_ptr<alloc_traits> ptr(raw_ptr, iocp_service_, buffers, handler); + if (!is_open(impl)) + { + ptr.get()->on_immediate_completion(WSAEBADF, 0); + ptr.release(); + return; + } + // Find first buffer of non-zero length. boost::asio::const_buffer buffer; typename ConstBufferSequence::const_iterator iter = buffers.begin(); @@ -489,10 +490,8 @@ public: // A request to write 0 bytes on a handle is a no-op. if (boost::asio::buffer_size(buffer) == 0) { - boost::asio::io_service::work work(this->get_io_service()); - ptr.reset(); - boost::system::error_code error; - iocp_service_.post(bind_handler(handler, error, 0)); + ptr.get()->on_immediate_completion(0, 0); + ptr.release(); return; } @@ -509,14 +508,12 @@ public: // Check if the operation completed immediately. if (!ok && last_error != ERROR_IO_PENDING) { - boost::asio::io_service::work work(this->get_io_service()); - ptr.reset(); - boost::system::error_code ec(last_error, - boost::asio::error::get_system_category()); - iocp_service_.post(bind_handler(handler, ec, bytes_transferred)); + ptr.get()->on_immediate_completion(last_error, bytes_transferred); + ptr.release(); } else { + ptr.get()->on_pending(); ptr.release(); } } @@ -604,6 +601,7 @@ public: ec = boost::system::error_code(last_error, boost::asio::error::get_system_category()); } + return 0; } ec = boost::system::error_code(); @@ -669,7 +667,7 @@ public: // Call the handler. boost_asio_handler_invoke_helpers::invoke( - bind_handler(handler, ec, bytes_transferred), &handler); + bind_handler(handler, ec, bytes_transferred), handler); } static void destroy_impl(operation* op) @@ -714,13 +712,6 @@ public: void async_read_some_at(implementation_type& impl, boost::uint64_t offset, const MutableBufferSequence& buffers, Handler handler) { - if (!is_open(impl)) - { - this->get_io_service().post(bind_handler(handler, - boost::asio::error::bad_descriptor, 0)); - return; - } - // Update the ID of the thread from which cancellation is safe. if (impl.safe_cancellation_thread_id_ == 0) impl.safe_cancellation_thread_id_ = ::GetCurrentThreadId(); @@ -733,6 +724,13 @@ public: raw_handler_ptr<alloc_traits> raw_ptr(handler); handler_ptr<alloc_traits> ptr(raw_ptr, iocp_service_, buffers, handler); + if (!is_open(impl)) + { + ptr.get()->on_immediate_completion(WSAEBADF, 0); + ptr.release(); + return; + } + // Find first buffer of non-zero length. boost::asio::mutable_buffer buffer; typename MutableBufferSequence::const_iterator iter = buffers.begin(); @@ -747,10 +745,8 @@ public: // A request to receive 0 bytes on a stream handle is a no-op. if (boost::asio::buffer_size(buffer) == 0) { - boost::asio::io_service::work work(this->get_io_service()); - ptr.reset(); - boost::system::error_code error; - iocp_service_.post(bind_handler(handler, error, 0)); + ptr.get()->on_immediate_completion(0, 0); + ptr.release(); return; } @@ -765,14 +761,12 @@ public: DWORD last_error = ::GetLastError(); if (!ok && last_error != ERROR_IO_PENDING && last_error != ERROR_MORE_DATA) { - boost::asio::io_service::work work(this->get_io_service()); - ptr.reset(); - boost::system::error_code ec(last_error, - boost::asio::error::get_system_category()); - iocp_service_.post(bind_handler(handler, ec, bytes_transferred)); + ptr.get()->on_immediate_completion(last_error, bytes_transferred); + ptr.release(); } else { + ptr.get()->on_pending(); ptr.release(); } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp index 5818542..1dfb9a1 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp @@ -2,7 +2,7 @@ // win_iocp_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -22,7 +22,7 @@ #if defined(BOOST_ASIO_HAS_IOCP) #include <boost/asio/detail/push_options.hpp> -#include <limits> +#include <boost/limits.hpp> #include <boost/throw_exception.hpp> #include <boost/system/system_error.hpp> #include <boost/asio/detail/pop_options.hpp> @@ -50,6 +50,8 @@ public: // This class inherits from OVERLAPPED so that we can downcast to get back to // the operation pointer from the LPOVERLAPPED out parameter of // GetQueuedCompletionStatus. + class operation; + friend class operation; class operation : public OVERLAPPED { @@ -59,7 +61,10 @@ public: operation(win_iocp_io_service& iocp_service, invoke_func_type invoke_func, destroy_func_type destroy_func) - : outstanding_operations_(&iocp_service.outstanding_operations_), + : iocp_service_(iocp_service), + ready_(0), + last_error_(~DWORD(0)), + bytes_transferred_(0), invoke_func_(invoke_func), destroy_func_(destroy_func) { @@ -69,12 +74,48 @@ public: OffsetHigh = 0; hEvent = 0; - ::InterlockedIncrement(outstanding_operations_); + ::InterlockedIncrement(&iocp_service_.outstanding_operations_); + } + + void reset() + { + Internal = 0; + InternalHigh = 0; + Offset = 0; + OffsetHigh = 0; + hEvent = 0; + ready_ = 0; + last_error_ = ~DWORD(0); + bytes_transferred_ = 0; + } + + void on_pending() + { + if (::InterlockedCompareExchange(&ready_, 1, 0) == 1) + iocp_service_.post_completion(this, last_error_, bytes_transferred_); } - void do_completion(DWORD last_error, size_t bytes_transferred) + void on_immediate_completion(DWORD last_error, DWORD bytes_transferred) { - invoke_func_(this, last_error, bytes_transferred); + ready_ = 1; + iocp_service_.post_completion(this, last_error, bytes_transferred); + } + + bool on_completion(DWORD last_error, DWORD bytes_transferred) + { + if (last_error_ == ~DWORD(0)) + { + last_error_ = last_error; + bytes_transferred_ = bytes_transferred; + } + + if (::InterlockedCompareExchange(&ready_, 1, 0) == 1) + { + invoke_func_(this, last_error_, bytes_transferred_); + return true; + } + + return false; } void destroy() @@ -86,16 +127,18 @@ public: // Prevent deletion through this type. ~operation() { - ::InterlockedDecrement(outstanding_operations_); + ::InterlockedDecrement(&iocp_service_.outstanding_operations_); } private: - long* outstanding_operations_; + win_iocp_io_service& iocp_service_; + long ready_; + DWORD last_error_; + DWORD bytes_transferred_; invoke_func_type invoke_func_; destroy_func_type destroy_func_; }; - // Constructor. win_iocp_io_service(boost::asio::io_service& io_service) : boost::asio::detail::service_base<win_iocp_io_service>(io_service), @@ -132,7 +175,7 @@ public: while (::InterlockedExchangeAdd(&outstanding_operations_, 0) > 0) { DWORD bytes_transferred = 0; -#if (WINVER < 0x0500) +#if defined(WINVER) && (WINVER < 0x0500) DWORD completion_key = 0; #else DWORD_PTR completion_key = 0; @@ -276,7 +319,7 @@ public: void dispatch(Handler handler) { if (call_stack<win_iocp_io_service>::contains(this)) - boost_asio_handler_invoke_helpers::invoke(handler, &handler); + boost_asio_handler_invoke_helpers::invoke(handler, handler); else post(handler); } @@ -296,15 +339,7 @@ public: handler_ptr<alloc_traits> ptr(raw_ptr, *this, handler); // Enqueue the operation on the I/O completion port. - if (!::PostQueuedCompletionStatus(iocp_.handle, 0, 0, ptr.get())) - { - DWORD last_error = ::GetLastError(); - boost::system::system_error e( - boost::system::error_code(last_error, - boost::asio::error::get_system_category()), - "pqcs"); - boost::throw_exception(e); - } + ptr.get()->on_immediate_completion(0, 0); // Operation has been successfully posted. ptr.release(); @@ -419,7 +454,7 @@ private: // Get the next operation from the queue. DWORD bytes_transferred = 0; -#if (WINVER < 0x0500) +#if defined(WINVER) && (WINVER < 0x0500) DWORD completion_key = 0; #else DWORD_PTR completion_key = 0; @@ -507,10 +542,11 @@ private: // Dispatch the operation. operation* op = static_cast<operation*>(overlapped); - op->do_completion(last_error, bytes_transferred); - - ec = boost::system::error_code(); - return 1; + if (op->on_completion(last_error, bytes_transferred)) + { + ec = boost::system::error_code(); + return 1; + } } else if (completion_key == transfer_timer_dispatching) { @@ -648,7 +684,7 @@ private: ptr.reset(); // Make the upcall. - boost_asio_handler_invoke_helpers::invoke(handler, &handler); + boost_asio_handler_invoke_helpers::invoke(handler, handler); } static void destroy_impl(operation* op) diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp index c9e6060..be413ec 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp @@ -2,7 +2,7 @@ // win_iocp_io_service_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp index e8ab6b0..bb64014 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp @@ -2,7 +2,7 @@ // win_iocp_overlapped_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -92,6 +92,9 @@ public: // Release ownership of the OVERLAPPED object. OVERLAPPED* release() { + if (ptr_) + ptr_->on_pending(); + OVERLAPPED* tmp = ptr_; ptr_ = 0; return tmp; @@ -104,8 +107,7 @@ public: if (ptr_) { ptr_->ec_ = ec; - ptr_->io_service_.post_completion(ptr_, 0, - static_cast<DWORD>(bytes_transferred)); + ptr_->on_immediate_completion(0, static_cast<DWORD>(bytes_transferred)); ptr_ = 0; } } @@ -171,7 +173,7 @@ private: // Make the upcall. boost_asio_handler_invoke_helpers::invoke( - bind_handler(handler, ec, bytes_transferred), &handler); + bind_handler(handler, ec, bytes_transferred), handler); } static void destroy_impl(win_iocp_io_service::operation* op) diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp index 57d56cf..4d6d2e9 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp @@ -2,7 +2,7 @@ // win_iocp_serial_port_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp index 5192612..e0c0806 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp @@ -2,7 +2,7 @@ // win_iocp_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -789,7 +789,7 @@ public: // Call the handler. boost_asio_handler_invoke_helpers::invoke( - detail::bind_handler(handler, ec, bytes_transferred), &handler); + detail::bind_handler(handler, ec, bytes_transferred), handler); } static void destroy_impl(operation* op) @@ -823,13 +823,6 @@ public: void async_send(implementation_type& impl, const ConstBufferSequence& buffers, socket_base::message_flags flags, Handler handler) { - if (!is_open(impl)) - { - this->get_io_service().post(bind_handler(handler, - boost::asio::error::bad_descriptor, 0)); - return; - } - #if defined(BOOST_ASIO_ENABLE_CANCELIO) // Update the ID of the thread from which cancellation is safe. if (impl.safe_cancellation_thread_id_ == 0) @@ -845,6 +838,13 @@ public: handler_ptr<alloc_traits> ptr(raw_ptr, iocp_service_, impl.cancel_token_, buffers, handler); + if (!is_open(impl)) + { + ptr.get()->on_immediate_completion(WSAEBADF, 0); + ptr.release(); + return; + } + // Copy buffers into WSABUF array. ::WSABUF bufs[max_buffers]; typename ConstBufferSequence::const_iterator iter = buffers.begin(); @@ -863,10 +863,8 @@ public: // A request to receive 0 bytes on a stream socket is a no-op. if (impl.protocol_.type() == SOCK_STREAM && total_buffer_size == 0) { - boost::asio::io_service::work work(this->get_io_service()); - ptr.reset(); - boost::system::error_code error; - iocp_service_.post(bind_handler(handler, error, 0)); + ptr.get()->on_immediate_completion(0, 0); + ptr.release(); return; } @@ -879,14 +877,12 @@ public: // Check if the operation completed immediately. if (result != 0 && last_error != WSA_IO_PENDING) { - boost::asio::io_service::work work(this->get_io_service()); - ptr.reset(); - boost::system::error_code ec(last_error, - boost::asio::error::get_system_category()); - iocp_service_.post(bind_handler(handler, ec, bytes_transferred)); + ptr.get()->on_immediate_completion(last_error, bytes_transferred); + ptr.release(); } else { + ptr.get()->on_pending(); ptr.release(); } } @@ -1068,7 +1064,7 @@ public: // Call the handler. boost_asio_handler_invoke_helpers::invoke( - detail::bind_handler(handler, ec, bytes_transferred), &handler); + detail::bind_handler(handler, ec, bytes_transferred), handler); } static void destroy_impl(operation* op) @@ -1102,13 +1098,6 @@ public: const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags, Handler handler) { - if (!is_open(impl)) - { - this->get_io_service().post(bind_handler(handler, - boost::asio::error::bad_descriptor, 0)); - return; - } - #if defined(BOOST_ASIO_ENABLE_CANCELIO) // Update the ID of the thread from which cancellation is safe. if (impl.safe_cancellation_thread_id_ == 0) @@ -1123,6 +1112,13 @@ public: raw_handler_ptr<alloc_traits> raw_ptr(handler); handler_ptr<alloc_traits> ptr(raw_ptr, iocp_service_, buffers, handler); + if (!is_open(impl)) + { + ptr.get()->on_immediate_completion(WSAEBADF, 0); + ptr.release(); + return; + } + // Copy buffers into WSABUF array. ::WSABUF bufs[max_buffers]; typename ConstBufferSequence::const_iterator iter = buffers.begin(); @@ -1145,14 +1141,12 @@ public: // Check if the operation completed immediately. if (result != 0 && last_error != WSA_IO_PENDING) { - boost::asio::io_service::work work(this->get_io_service()); - ptr.reset(); - boost::system::error_code ec(last_error, - boost::asio::error::get_system_category()); - iocp_service_.post(bind_handler(handler, ec, bytes_transferred)); + ptr.get()->on_immediate_completion(last_error, bytes_transferred); + ptr.release(); } else { + ptr.get()->on_pending(); ptr.release(); } } @@ -1339,7 +1333,7 @@ public: // Call the handler. boost_asio_handler_invoke_helpers::invoke( - detail::bind_handler(handler, ec, bytes_transferred), &handler); + detail::bind_handler(handler, ec, bytes_transferred), handler); } static void destroy_impl(operation* op) @@ -1375,13 +1369,6 @@ public: const MutableBufferSequence& buffers, socket_base::message_flags flags, Handler handler) { - if (!is_open(impl)) - { - this->get_io_service().post(bind_handler(handler, - boost::asio::error::bad_descriptor, 0)); - return; - } - #if defined(BOOST_ASIO_ENABLE_CANCELIO) // Update the ID of the thread from which cancellation is safe. if (impl.safe_cancellation_thread_id_ == 0) @@ -1398,6 +1385,13 @@ public: handler_ptr<alloc_traits> ptr(raw_ptr, protocol_type, iocp_service_, impl.cancel_token_, buffers, handler); + if (!is_open(impl)) + { + ptr.get()->on_immediate_completion(WSAEBADF, 0); + ptr.release(); + return; + } + // Copy buffers into WSABUF array. ::WSABUF bufs[max_buffers]; typename MutableBufferSequence::const_iterator iter = buffers.begin(); @@ -1415,10 +1409,8 @@ public: // A request to receive 0 bytes on a stream socket is a no-op. if (impl.protocol_.type() == SOCK_STREAM && total_buffer_size == 0) { - boost::asio::io_service::work work(this->get_io_service()); - ptr.reset(); - boost::system::error_code error; - iocp_service_.post(bind_handler(handler, error, 0)); + ptr.get()->on_immediate_completion(0, 0); + ptr.release(); return; } @@ -1430,14 +1422,12 @@ public: DWORD last_error = ::WSAGetLastError(); if (result != 0 && last_error != WSA_IO_PENDING) { - boost::asio::io_service::work work(this->get_io_service()); - ptr.reset(); - boost::system::error_code ec(last_error, - boost::asio::error::get_system_category()); - iocp_service_.post(bind_handler(handler, ec, bytes_transferred)); + ptr.get()->on_immediate_completion(last_error, bytes_transferred); + ptr.release(); } else { + ptr.get()->on_pending(); ptr.release(); } } @@ -1482,14 +1472,12 @@ public: DWORD last_error = ::WSAGetLastError(); if (result != 0 && last_error != WSA_IO_PENDING) { - boost::asio::io_service::work work(this->get_io_service()); - ptr.reset(); - boost::system::error_code ec(last_error, - boost::asio::error::get_system_category()); - iocp_service_.post(bind_handler(handler, ec, bytes_transferred)); + ptr.get()->on_immediate_completion(last_error, bytes_transferred); + ptr.release(); } else { + ptr.get()->on_pending(); ptr.release(); } } @@ -1672,7 +1660,7 @@ public: // Call the handler. boost_asio_handler_invoke_helpers::invoke( - detail::bind_handler(handler, ec, bytes_transferred), &handler); + detail::bind_handler(handler, ec, bytes_transferred), handler); } static void destroy_impl(operation* op) @@ -1710,13 +1698,6 @@ public: const MutableBufferSequence& buffers, endpoint_type& sender_endp, socket_base::message_flags flags, Handler handler) { - if (!is_open(impl)) - { - this->get_io_service().post(bind_handler(handler, - boost::asio::error::bad_descriptor, 0)); - return; - } - #if defined(BOOST_ASIO_ENABLE_CANCELIO) // Update the ID of the thread from which cancellation is safe. if (impl.safe_cancellation_thread_id_ == 0) @@ -1733,6 +1714,13 @@ public: handler_ptr<alloc_traits> ptr(raw_ptr, protocol_type, iocp_service_, sender_endp, buffers, handler); + if (!is_open(impl)) + { + ptr.get()->on_immediate_completion(WSAEBADF, 0); + ptr.release(); + return; + } + // Copy buffers into WSABUF array. ::WSABUF bufs[max_buffers]; typename MutableBufferSequence::const_iterator iter = buffers.begin(); @@ -1754,14 +1742,12 @@ public: DWORD last_error = ::WSAGetLastError(); if (result != 0 && last_error != WSA_IO_PENDING) { - boost::asio::io_service::work work(this->get_io_service()); - ptr.reset(); - boost::system::error_code ec(last_error, - boost::asio::error::get_system_category()); - iocp_service_.post(bind_handler(handler, ec, bytes_transferred)); + ptr.get()->on_immediate_completion(last_error, bytes_transferred); + ptr.release(); } else { + ptr.get()->on_pending(); ptr.release(); } } @@ -1925,11 +1911,7 @@ public: && !ptr.get()->enable_connection_aborted_) { // Reset OVERLAPPED structure. - ptr.get()->Internal = 0; - ptr.get()->InternalHigh = 0; - ptr.get()->Offset = 0; - ptr.get()->OffsetHigh = 0; - ptr.get()->hEvent = 0; + ptr.get()->reset(); // Create a new socket for the next connection, since the AcceptEx call // fails with WSAEINVAL if we try to reuse the same socket. @@ -1954,7 +1936,7 @@ public: || last_error == WSAECONNABORTED) { // Post this handler so that operation will be restarted again. - ptr.get()->io_service_.post_completion(ptr.get(), last_error, 0); + ptr.get()->on_immediate_completion(last_error, 0); ptr.release(); return; } @@ -1966,6 +1948,7 @@ public: else { // Asynchronous operation has been successfully restarted. + ptr.get()->on_pending(); ptr.release(); return; } @@ -2038,7 +2021,7 @@ public: boost::system::error_code ec(last_error, boost::asio::error::get_system_category()); boost_asio_handler_invoke_helpers::invoke( - detail::bind_handler(handler, ec), &handler); + detail::bind_handler(handler, ec), handler); } static void destroy_impl(operation* op) @@ -2141,7 +2124,7 @@ public: // Post handler so that operation will be restarted again. We do not // perform the AcceptEx again here to avoid the possibility of starving // other handlers. - iocp_service_.post_completion(ptr.get(), last_error, 0); + ptr.get()->on_immediate_completion(last_error, 0); ptr.release(); } else @@ -2155,6 +2138,7 @@ public: } else { + ptr.get()->on_pending(); ptr.release(); } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp index f5470c4..107d707 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp @@ -2,7 +2,7 @@ // win_mutex.hpp // ~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/win_signal_blocker.hpp b/3rdParty/Boost/src/boost/asio/detail/win_signal_blocker.hpp index e9b4d37..6d70a16 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_signal_blocker.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_signal_blocker.hpp @@ -2,7 +2,7 @@ // win_signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp index c8058d8..61c9b8a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp @@ -2,7 +2,7 @@ // win_thread.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -40,7 +40,7 @@ namespace detail { unsigned int __stdcall win_thread_function(void* arg); -#if (WINVER < 0x0500) +#if defined(WINVER) && (WINVER < 0x0500) void __stdcall apc_function(ULONG data); #else void __stdcall apc_function(ULONG_PTR data); @@ -156,7 +156,7 @@ public: private: friend unsigned int __stdcall win_thread_function(void* arg); -#if (WINVER < 0x0500) +#if defined(WINVER) && (WINVER < 0x0500) friend void __stdcall apc_function(ULONG); #else friend void __stdcall apc_function(ULONG_PTR); @@ -217,7 +217,7 @@ inline unsigned int __stdcall win_thread_function(void* arg) return 0; } -#if (WINVER < 0x0500) +#if defined(WINVER) && (WINVER < 0x0500) inline void __stdcall apc_function(ULONG) {} #else inline void __stdcall apc_function(ULONG_PTR) {} diff --git a/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp index 5c56454..fa04613 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp @@ -2,7 +2,7 @@ // win_tss_ptr.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp index 7b24ec2..1cb9a7a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp @@ -2,7 +2,7 @@ // wince_thread.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp b/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp index 827cf58..186a8b5 100644 --- a/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp @@ -2,7 +2,7 @@ // winsock_init.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp index 64fc729..8f2f625 100644 --- a/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp @@ -2,7 +2,7 @@ // wrapped_handler.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -18,7 +18,7 @@ #include <boost/asio/detail/push_options.hpp> #include <boost/asio/detail/push_options.hpp> -#include <boost/type_traits.hpp> +#include <boost/type_traits/add_reference.hpp> #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/detail/bind_handler.hpp> @@ -158,7 +158,7 @@ inline void* asio_handler_allocate(std::size_t size, wrapped_handler<Dispatcher, Handler>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( - size, &this_handler->handler_); + size, this_handler->handler_); } template <typename Dispatcher, typename Handler> @@ -166,7 +166,7 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, wrapped_handler<Dispatcher, Handler>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( - pointer, size, &this_handler->handler_); + pointer, size, this_handler->handler_); } template <typename Function, typename Dispatcher, typename Handler> @@ -183,7 +183,7 @@ inline void* asio_handler_allocate(std::size_t size, rewrapped_handler<Handler, Context>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( - size, &this_handler->context_); + size, this_handler->context_); } template <typename Handler, typename Context> @@ -191,7 +191,7 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, rewrapped_handler<Handler, Context>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( - pointer, size, &this_handler->context_); + pointer, size, this_handler->context_); } template <typename Function, typename Handler, typename Context> @@ -199,7 +199,7 @@ inline void asio_handler_invoke(const Function& function, rewrapped_handler<Handler, Context>* this_handler) { boost_asio_handler_invoke_helpers::invoke( - function, &this_handler->context_); + function, this_handler->context_); } } // namespace detail |