diff options
author | Tobias Markmann <tm@ayena.de> | 2014-10-19 20:22:58 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2014-10-20 13:49:33 (GMT) |
commit | 6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch) | |
tree | 2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/asio/detail/winrt_timer_scheduler.hpp | |
parent | 38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff) | |
download | swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2 |
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0.
Updated our update.sh script to stop on error.
Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to
missing include of <iostream> with newer Boost.
Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/asio/detail/winrt_timer_scheduler.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/detail/winrt_timer_scheduler.hpp | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/asio/detail/winrt_timer_scheduler.hpp b/3rdParty/Boost/src/boost/asio/detail/winrt_timer_scheduler.hpp new file mode 100644 index 0000000..9cadeca --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/winrt_timer_scheduler.hpp @@ -0,0 +1,133 @@ +// +// detail/winrt_timer_scheduler.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// 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_DETAIL_WINRT_TIMER_SCHEDULER_HPP +#define BOOST_ASIO_DETAIL_WINRT_TIMER_SCHEDULER_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_WINDOWS_RUNTIME) + +#include <cstddef> +#include <boost/asio/detail/event.hpp> +#include <boost/asio/detail/limits.hpp> +#include <boost/asio/detail/mutex.hpp> +#include <boost/asio/detail/op_queue.hpp> +#include <boost/asio/detail/thread.hpp> +#include <boost/asio/detail/timer_queue_base.hpp> +#include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> +#include <boost/asio/io_service.hpp> + +#if defined(BOOST_ASIO_HAS_IOCP) +# include <boost/asio/detail/thread.hpp> +#endif // defined(BOOST_ASIO_HAS_IOCP) + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +class winrt_timer_scheduler + : public boost::asio::detail::service_base<winrt_timer_scheduler> +{ +public: + // Constructor. + BOOST_ASIO_DECL winrt_timer_scheduler(boost::asio::io_service& io_service); + + // Destructor. + BOOST_ASIO_DECL ~winrt_timer_scheduler(); + + // Destroy all user-defined handler objects owned by the service. + BOOST_ASIO_DECL void shutdown_service(); + + // Recreate internal descriptors following a fork. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + + // Initialise the task. No effect as this class uses its own thread. + BOOST_ASIO_DECL void init_task(); + + // Add a new timer queue to the reactor. + template <typename Time_Traits> + void add_timer_queue(timer_queue<Time_Traits>& queue); + + // Remove a timer queue from the reactor. + template <typename Time_Traits> + void remove_timer_queue(timer_queue<Time_Traits>& queue); + + // Schedule a new operation in the given timer queue to expire at the + // specified absolute time. + template <typename Time_Traits> + void schedule_timer(timer_queue<Time_Traits>& queue, + const typename Time_Traits::time_type& time, + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); + + // Cancel the timer operations associated with the given token. Returns the + // number of operations that have been posted or dispatched. + template <typename Time_Traits> + std::size_t cancel_timer(timer_queue<Time_Traits>& queue, + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); + +private: + // Run the select loop in the thread. + BOOST_ASIO_DECL void run_thread(); + + // Entry point for the select loop thread. + BOOST_ASIO_DECL static void call_run_thread(winrt_timer_scheduler* reactor); + + // Helper function to add a new timer queue. + BOOST_ASIO_DECL void do_add_timer_queue(timer_queue_base& queue); + + // Helper function to remove a timer queue. + BOOST_ASIO_DECL void do_remove_timer_queue(timer_queue_base& queue); + + // The io_service implementation used to post completions. + io_service_impl& io_service_; + + // Mutex used to protect internal variables. + boost::asio::detail::mutex mutex_; + + // Event used to wake up background thread. + boost::asio::detail::event event_; + + // The timer queues. + timer_queue_set timer_queues_; + + // The background thread that is waiting for timers to expire. + boost::asio::detail::thread* thread_; + + // Does the background thread need to stop. + bool stop_thread_; + + // Whether the service has been shut down. + bool shutdown_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#include <boost/asio/detail/impl/winrt_timer_scheduler.hpp> +#if defined(BOOST_ASIO_HEADER_ONLY) +# include <boost/asio/detail/impl/winrt_timer_scheduler.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + +#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) + +#endif // BOOST_ASIO_DETAIL_WINRT_TIMER_SCHEDULER_HPP |