From 61dc492f315dd8413287787b840037a454d557cc Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Fri, 19 Jun 2015 18:55:02 +0200 Subject: [PATCH] some stuff/corrections --- include/boost/fiber/bounded_channel.hpp | 1 - include/boost/fiber/detail/fifo.hpp | 2 +- include/boost/fiber/detail/fss.hpp | 2 +- include/boost/fiber/detail/terminated_queue.hpp | 2 +- include/boost/fiber/detail/waiting_queue.hpp | 2 +- include/boost/fiber/exceptions.hpp | 3 ++- include/boost/fiber/fiber_manager.hpp | 2 +- include/boost/fiber/future/async.hpp | 4 ++-- include/boost/fiber/interruption.hpp | 3 +++ include/boost/fiber/properties.hpp | 2 +- src/algorithm.cpp | 4 +--- src/barrier.cpp | 1 - src/detail/fifo.cpp | 1 - src/detail/spinlock.cpp | 8 ++++---- src/detail/terminated_queue.cpp | 3 +-- src/detail/waiting_queue.cpp | 6 +++--- src/fiber.cpp | 1 - src/fiber_context.cpp | 2 -- src/fiber_manager.cpp | 2 +- src/future.cpp | 1 + src/interruption.cpp | 3 +++ src/mutex.cpp | 1 - src/properties.cpp | 4 +++- src/recursive_mutex.cpp | 1 - src/round_robin.cpp | 2 +- 25 files changed, 31 insertions(+), 32 deletions(-) diff --git a/include/boost/fiber/bounded_channel.hpp b/include/boost/fiber/bounded_channel.hpp index b93891e4..106abd40 100644 --- a/include/boost/fiber/bounded_channel.hpp +++ b/include/boost/fiber/bounded_channel.hpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/fiber/detail/fifo.hpp b/include/boost/fiber/detail/fifo.hpp index 94974082..fe80010d 100644 --- a/include/boost/fiber/detail/fifo.hpp +++ b/include/boost/fiber/detail/fifo.hpp @@ -25,7 +25,7 @@ class fiber_context; namespace detail { -class fifo { +class BOOST_FIBERS_DECL fifo { public: fifo() noexcept : head_( nullptr), diff --git a/include/boost/fiber/detail/fss.hpp b/include/boost/fiber/detail/fss.hpp index 6687fba4..2e072a7a 100644 --- a/include/boost/fiber/detail/fss.hpp +++ b/include/boost/fiber/detail/fss.hpp @@ -24,7 +24,7 @@ namespace boost { namespace fibers { namespace detail { -class BOOST_FIBERS_DECL fss_cleanup_function { +class fss_cleanup_function { private: std::atomic< std::size_t > use_count_; diff --git a/include/boost/fiber/detail/terminated_queue.hpp b/include/boost/fiber/detail/terminated_queue.hpp index 304b90c8..ad844306 100644 --- a/include/boost/fiber/detail/terminated_queue.hpp +++ b/include/boost/fiber/detail/terminated_queue.hpp @@ -25,7 +25,7 @@ class fiber_context; namespace detail { -class terminated_queue { +class BOOST_FIBERS_DECL terminated_queue { public: terminated_queue() noexcept : head_( nullptr), diff --git a/include/boost/fiber/detail/waiting_queue.hpp b/include/boost/fiber/detail/waiting_queue.hpp index d65b0870..94126956 100644 --- a/include/boost/fiber/detail/waiting_queue.hpp +++ b/include/boost/fiber/detail/waiting_queue.hpp @@ -26,7 +26,7 @@ struct sched_algorithm; namespace detail { -class waiting_queue { +class BOOST_FIBERS_DECL waiting_queue { public: waiting_queue() noexcept : head_( nullptr) { diff --git a/include/boost/fiber/exceptions.hpp b/include/boost/fiber/exceptions.hpp index c94db85e..b02d68ae 100644 --- a/include/boost/fiber/exceptions.hpp +++ b/include/boost/fiber/exceptions.hpp @@ -166,7 +166,8 @@ enum class future_errc { no_state }; -BOOST_FIBERS_DECL std::error_category const& future_category() noexcept; +BOOST_FIBERS_DECL +std::error_category const& future_category() noexcept; }} diff --git a/include/boost/fiber/fiber_manager.hpp b/include/boost/fiber/fiber_manager.hpp index 8d651807..c77561fe 100644 --- a/include/boost/fiber/fiber_manager.hpp +++ b/include/boost/fiber/fiber_manager.hpp @@ -28,7 +28,7 @@ namespace fibers { class fiber_context; struct sched_algorithm; -struct fiber_manager { +struct BOOST_FIBERS_DECL fiber_manager { private: typedef detail::waiting_queue wqueue_t; typedef detail::terminated_queue tqueue_t; diff --git a/include/boost/fiber/future/async.hpp b/include/boost/fiber/future/async.hpp index f0a739ac..1e840137 100644 --- a/include/boost/fiber/future/async.hpp +++ b/include/boost/fiber/future/async.hpp @@ -21,7 +21,7 @@ namespace fibers { template< typename Fn, typename ... Args > future< typename std::result_of< Fn( Args ... ) >::type > -async( Fn fn, Args && ... args) { +async( Fn && fn, Args && ... args) { typedef typename std::result_of< Fn( Args ... ) >::type result_type; packaged_task< result_type( Args ... ) > pt( std::forward< Fn >( fn) ); @@ -32,7 +32,7 @@ async( Fn fn, Args && ... args) { template< typename StackAllocator, typename Fn, typename ... Args > future< typename std::result_of< Fn( Args ... ) >::type > -async( StackAllocator salloc, Fn fn, Args && ... args) { +async( StackAllocator salloc, Fn && fn, Args && ... args) { typedef typename std::result_of< Fn( Args ... ) >::type result_type; packaged_task< result_type( Args ... ) > pt( diff --git a/include/boost/fiber/interruption.hpp b/include/boost/fiber/interruption.hpp index da6cc63a..c9d42683 100644 --- a/include/boost/fiber/interruption.hpp +++ b/include/boost/fiber/interruption.hpp @@ -50,10 +50,13 @@ public: restore_interruption & operator=( restore_interruption const&) = delete; }; +BOOST_FIBERS_DECL bool interruption_enabled() noexcept; +BOOST_FIBERS_DECL bool interruption_requested() noexcept; +BOOST_FIBERS_DECL void interruption_point(); }} diff --git a/include/boost/fiber/properties.hpp b/include/boost/fiber/properties.hpp index 964afb02..eaa40803 100644 --- a/include/boost/fiber/properties.hpp +++ b/include/boost/fiber/properties.hpp @@ -27,7 +27,7 @@ namespace fibers { struct sched_algorithm; class fiber_context; -class fiber_properties { +class BOOST_FIBERS_DECL fiber_properties { protected: // initialized by constructor fiber_context * fiber_; diff --git a/src/algorithm.cpp b/src/algorithm.cpp index 2f5c4535..863bf484 100644 --- a/src/algorithm.cpp +++ b/src/algorithm.cpp @@ -6,9 +6,7 @@ #include "boost/fiber/algorithm.hpp" -#include - -#include +#include "boost/fiber/fiber_context.hpp" #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX diff --git a/src/barrier.cpp b/src/barrier.cpp index e9663649..042904ef 100644 --- a/src/barrier.cpp +++ b/src/barrier.cpp @@ -6,7 +6,6 @@ #include "boost/fiber/barrier.hpp" -#include #include #include "boost/fiber/exceptions.hpp" diff --git a/src/detail/fifo.cpp b/src/detail/fifo.cpp index 94f89113..bc9495be 100644 --- a/src/detail/fifo.cpp +++ b/src/detail/fifo.cpp @@ -7,7 +7,6 @@ #include "boost/fiber/detail/fifo.hpp" #include -#include #include diff --git a/src/detail/spinlock.cpp b/src/detail/spinlock.cpp index 0843abcb..1227c0c1 100644 --- a/src/detail/spinlock.cpp +++ b/src/detail/spinlock.cpp @@ -4,13 +4,13 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include +#include "boost/fiber/detail/spinlock.hpp" #include -#include -#include -#include +#include "boost/fiber/detail/scheduler.hpp" +#include "boost/fiber/fiber_context.hpp" +#include "boost/fiber/fiber_manager.hpp" namespace boost { namespace fibers { diff --git a/src/detail/terminated_queue.cpp b/src/detail/terminated_queue.cpp index afbc32a2..2711c65f 100644 --- a/src/detail/terminated_queue.cpp +++ b/src/detail/terminated_queue.cpp @@ -7,9 +7,8 @@ #include "boost/fiber/detail/terminated_queue.hpp" #include -#include -#include +#include "boost/fiber/fiber_context.hpp" #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX diff --git a/src/detail/waiting_queue.cpp b/src/detail/waiting_queue.cpp index 67081ea9..61ecd507 100644 --- a/src/detail/waiting_queue.cpp +++ b/src/detail/waiting_queue.cpp @@ -14,9 +14,9 @@ #include #include -#include -#include -#include +#include "boost/fiber/algorithm.hpp" +#include "boost/fiber/detail/config.hpp" +#include "boost/fiber/fiber_context.hpp" #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX diff --git a/src/fiber.cpp b/src/fiber.cpp index e35c2563..57e1cd41 100644 --- a/src/fiber.cpp +++ b/src/fiber.cpp @@ -9,7 +9,6 @@ #include #include -#include #include "boost/fiber/fiber_context.hpp" #include "boost/fiber/exceptions.hpp" diff --git a/src/fiber_context.cpp b/src/fiber_context.cpp index 9fb6d35d..32f25ece 100644 --- a/src/fiber_context.cpp +++ b/src/fiber_context.cpp @@ -6,8 +6,6 @@ #include "boost/fiber/fiber_context.hpp" -#include - #include "boost/fiber/detail/scheduler.hpp" #include "boost/fiber/exceptions.hpp" #include "boost/fiber/properties.hpp" diff --git a/src/fiber_manager.cpp b/src/fiber_manager.cpp index 7f714c15..b4a2b7b8 100644 --- a/src/fiber_manager.cpp +++ b/src/fiber_manager.cpp @@ -4,7 +4,7 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include +#include "boost/fiber/fiber_manager.hpp" #include #include // std::this_thread::sleep_until() diff --git a/src/future.cpp b/src/future.cpp index 10912d0b..1fe1afb8 100644 --- a/src/future.cpp +++ b/src/future.cpp @@ -63,6 +63,7 @@ public: } }; +BOOST_FIBERS_DECL std::error_category const& future_category() noexcept { static fibers::future_error_category cat; return cat; diff --git a/src/interruption.cpp b/src/interruption.cpp index 222b62af..8d303701 100644 --- a/src/interruption.cpp +++ b/src/interruption.cpp @@ -45,14 +45,17 @@ restore_interruption::~restore_interruption() noexcept { } } +BOOST_FIBERS_DECL bool interruption_enabled() noexcept { return ! fibers::detail::scheduler::instance()->active()->interruption_blocked(); } +BOOST_FIBERS_DECL bool interruption_requested() noexcept { return fibers::detail::scheduler::instance()->active()->interruption_requested(); } +BOOST_FIBERS_DECL void interruption_point() { if ( interruption_requested() && interruption_enabled() ) { fibers::detail::scheduler::instance()->active()->request_interruption( false); diff --git a/src/mutex.cpp b/src/mutex.cpp index e1d3c0c1..f28c0084 100644 --- a/src/mutex.cpp +++ b/src/mutex.cpp @@ -7,7 +7,6 @@ #include "boost/fiber/mutex.hpp" #include -#include #include diff --git a/src/properties.cpp b/src/properties.cpp index e0b345e7..c1877d44 100644 --- a/src/properties.cpp +++ b/src/properties.cpp @@ -3,8 +3,10 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include "boost/fiber/properties.hpp" + +#include + #include "boost/fiber/algorithm.hpp" #include "boost/fiber/fiber_manager.hpp" #include "boost/fiber/fiber_context.hpp" diff --git a/src/recursive_mutex.cpp b/src/recursive_mutex.cpp index 679c852b..b90503df 100644 --- a/src/recursive_mutex.cpp +++ b/src/recursive_mutex.cpp @@ -7,7 +7,6 @@ #include "boost/fiber/recursive_mutex.hpp" #include -#include #include diff --git a/src/round_robin.cpp b/src/round_robin.cpp index 68994c5a..03a32c24 100644 --- a/src/round_robin.cpp +++ b/src/round_robin.cpp @@ -8,7 +8,7 @@ #include -#include +#include "boost/fiber/fiber_context.hpp" #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX