diff options
Diffstat (limited to '3rdParty/Boost/src/boost/asio/io_service.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/io_service.hpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/3rdParty/Boost/src/boost/asio/io_service.hpp b/3rdParty/Boost/src/boost/asio/io_service.hpp index 43b94e4..16b0bbf 100644 --- a/3rdParty/Boost/src/boost/asio/io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/io_service.hpp @@ -1,89 +1,87 @@ // // io_service.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BOOST_ASIO_IO_SERVICE_HPP #define BOOST_ASIO_IO_SERVICE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <cstddef> #include <stdexcept> #include <typeinfo> +#include <boost/asio/async_result.hpp> #include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/service_registry_fwd.hpp> #include <boost/asio/detail/wrapped_handler.hpp> #include <boost/system/error_code.hpp> -#if defined(BOOST_ASIO_HAS_IOCP) -# include <boost/asio/detail/win_iocp_io_service_fwd.hpp> -#else -# include <boost/asio/detail/task_io_service_fwd.hpp> -#endif - -#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) +#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) # include <boost/asio/detail/winsock_init.hpp> #elif defined(__sun) || defined(__QNX__) || defined(__hpux) || defined(_AIX) \ || defined(__osf__) # include <boost/asio/detail/signal_init.hpp> #endif #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { class io_service; template <typename Service> Service& use_service(io_service& ios); template <typename Service> void add_service(io_service& ios, Service* svc); template <typename Service> bool has_service(io_service& ios); +namespace detail { #if defined(BOOST_ASIO_HAS_IOCP) -namespace detail { typedef win_iocp_io_service io_service_impl; } + typedef class win_iocp_io_service io_service_impl; + class win_iocp_overlapped_ptr; #else -namespace detail { typedef task_io_service io_service_impl; } + typedef class task_io_service io_service_impl; #endif + class service_registry; +} // namespace detail /// Provides core I/O functionality. /** * The io_service class provides the core I/O functionality for users of the * asynchronous I/O objects, including: * * @li boost::asio::ip::tcp::socket * @li boost::asio::ip::tcp::acceptor * @li boost::asio::ip::udp::socket * @li boost::asio::deadline_timer. * * The io_service class also includes facilities intended for developers of * custom asynchronous services. * * @par Thread Safety * @e Distinct @e objects: Safe.@n * @e Shared @e objects: Safe, with the specific exceptions of the reset() and * notify_fork() functions. Calling reset() while there are unfinished run(), * run_one(), poll() or poll_one() calls results in undefined behaviour. The * notify_fork() function should not be called while any io_service function, * or any function on an I/O object that is associated with the io_service, is * being called in another thread. * * @par Concepts: * Dispatcher. * * @par Synchronous and asynchronous operations * * Synchronous operations on I/O objects implicitly run the io_service object * for an individual operation. The io_service functions run(), run_one(), * poll() or poll_one() must be called for the io_service to perform * asynchronous operations on behalf of a C++ program. Notification that an * asynchronous operation has completed is delivered by invocation of the * associated handler. Handlers are invoked only by a thread that is currently * calling any overload of run(), run_one(), poll() or poll_one() for the @@ -409,96 +407,98 @@ public: /// Reset the io_service in preparation for a subsequent run() invocation. /** * This function must be called prior to any second or later set of * invocations of the run(), run_one(), poll() or poll_one() functions when a * previous invocation of these functions returned due to the io_service * being stopped or running out of work. After a call to reset(), the * io_service object's stopped() function will return @c false. * * This function must not be called while there are any unfinished calls to * the run(), run_one(), poll() or poll_one() functions. */ BOOST_ASIO_DECL void reset(); /// Request the io_service to invoke the given handler. /** * This function is used to ask the io_service to execute the given handler. * * The io_service guarantees that the handler will only be called in a thread * in which the run(), run_one(), poll() or poll_one() member functions is * currently being invoked. The handler may be executed inside this function * if the guarantee can be met. * * @param handler The handler to be called. The io_service will make * a copy of the handler object as required. The function signature of the * handler must be: @code void handler(); @endcode * * @note This function throws an exception only if: * * @li the handler's @c asio_handler_allocate function; or * * @li the handler's copy constructor * * throws an exception. */ template <typename CompletionHandler> - void dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler); + BOOST_ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) + dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler); /// Request the io_service to invoke the given handler and return immediately. /** * This function is used to ask the io_service to execute the given handler, * but without allowing the io_service to call the handler from inside this * function. * * The io_service guarantees that the handler will only be called in a thread * in which the run(), run_one(), poll() or poll_one() member functions is * currently being invoked. * * @param handler The handler to be called. The io_service will make * a copy of the handler object as required. The function signature of the * handler must be: @code void handler(); @endcode * * @note This function throws an exception only if: * * @li the handler's @c asio_handler_allocate function; or * * @li the handler's copy constructor * * throws an exception. */ template <typename CompletionHandler> - void post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler); + BOOST_ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) + post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler); /// Create a new handler that automatically dispatches the wrapped handler /// on the io_service. /** * This function is used to create a new handler function object that, when * invoked, will automatically pass the wrapped handler to the io_service * object's dispatch function. * * @param handler The handler to be wrapped. The io_service will make a copy * of the handler object as required. The function signature of the handler * must be: @code void handler(A1 a1, ... An an); @endcode * * @return A function object that, when invoked, passes the wrapped handler to * the io_service object's dispatch function. Given a function object with the * signature: * @code R f(A1 a1, ... An an); @endcode * If this function object is passed to the wrap function like so: * @code io_service.wrap(f); @endcode * then the return value is a function object with the signature * @code void g(A1 a1, ... An an); @endcode * that, when invoked, executes code equivalent to: * @code io_service.dispatch(boost::bind(f, a1, ... an)); @endcode */ template <typename Handler> #if defined(GENERATING_DOCUMENTATION) unspecified #else detail::wrapped_handler<io_service&, Handler> #endif wrap(Handler handler); /// Fork-related event notifications. enum fork_event { /// Notify the io_service that the process is about to fork. @@ -568,71 +568,71 @@ public: friend Service& use_service(io_service& ios); /// Add a service object to the io_service. /** * This function is used to add a service to the io_service. * * @param ios The io_service object that owns the service. * * @param svc The service object. On success, ownership of the service object * is transferred to the io_service. When the io_service object is destroyed, * it will destroy the service object by performing: * @code delete static_cast<io_service::service*>(svc) @endcode * * @throws boost::asio::service_already_exists Thrown if a service of the * given type is already present in the io_service. * * @throws boost::asio::invalid_service_owner Thrown if the service's owning * io_service is not the io_service object specified by the ios parameter. */ template <typename Service> friend void add_service(io_service& ios, Service* svc); /// Determine if an io_service contains a specified service type. /** * This function is used to determine whether the io_service contains a * service object corresponding to the given service type. * * @param ios The io_service object that owns the service. * * @return A boolean indicating whether the io_service contains the service. */ template <typename Service> friend bool has_service(io_service& ios); private: -#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) +#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) detail::winsock_init<> init_; #elif defined(__sun) || defined(__QNX__) || defined(__hpux) || defined(_AIX) \ || defined(__osf__) detail::signal_init<> init_; #endif // The service registry. boost::asio::detail::service_registry* service_registry_; // The implementation. impl_type& impl_; }; /// Class to inform the io_service when it has work to do. /** * The work class is used to inform the io_service when work starts and * finishes. This ensures that the io_service object's run() function will not * exit while work is underway, and that it does exit when there is no * unfinished work remaining. * * The work class is copy-constructible so that it may be used as a data member * in a handler class. It is not assignable. */ class io_service::work { public: /// Constructor notifies the io_service that work is starting. /** * The constructor is used to inform the io_service that some work has begun. * This ensures that the io_service object's run() function will not exit * while the work is underway. */ explicit work(boost::asio::io_service& io_service); /// Copy constructor notifies the io_service that work is starting. |