diff --git a/examples/asio/detail/spawn.hpp b/examples/asio/detail/spawn.hpp index fbe53e92..a44488b0 100644 --- a/examples/asio/detail/spawn.hpp +++ b/examples/asio/detail/spawn.hpp @@ -21,8 +21,7 @@ #include #include -#include -#include +#include #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX @@ -60,7 +59,7 @@ public: } //private: - boost::fibers::detail::fiber_base * fiber_; + boost::fibers::fiber_context * fiber_; Handler & handler_; boost::system::error_code * ec_; T * value_; @@ -90,7 +89,7 @@ public: } //private: - boost::fibers::detail::fiber_base * fiber_; + boost::fibers::fiber_context * fiber_; Handler & handler_; boost::system::error_code * ec_; }; @@ -185,7 +184,7 @@ public: { fibers::detail::spinlock splk; std::unique_lock< fibers::detail::spinlock > lk( splk); - boost::fibers::fm_wait(lk); + boost::fibers::detail::scheduler::instance()->wait(lk); if ( ! out_ec_ && ec_) throw boost::system::system_error( ec_); return value_; } @@ -213,7 +212,7 @@ public: { fibers::detail::spinlock splk; std::unique_lock< fibers::detail::spinlock > lk( splk); - boost::fibers::fm_wait(lk); + boost::fibers::detail::scheduler::instance()->wait(lk); if ( ! out_ec_ && ec_) throw boost::system::system_error( ec_); } @@ -240,7 +239,7 @@ struct spawn_data : private noncopyable {} boost::asio::io_service& io_svc_; - boost::fibers::detail::fiber_base* fiber_; + boost::fibers::fiber_context* fiber_; Handler handler_; bool call_handler_; Function function_; @@ -252,7 +251,7 @@ struct fiber_entry_point void operator()() { shared_ptr< spawn_data< Handler, Function > > data( data_); - data->fiber_ = boost::fibers::fm_active(); + data->fiber_ = boost::fibers::detail::scheduler::instance()->active(); const basic_yield_context< Handler > yield( data->fiber_, data->handler_); diff --git a/examples/asio/detail/use_future.hpp b/examples/asio/detail/use_future.hpp index ed77489d..b22bd815 100644 --- a/examples/asio/detail/use_future.hpp +++ b/examples/asio/detail/use_future.hpp @@ -18,9 +18,11 @@ #include #include #include +#include +#include +#include -#include -#include +#include #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX @@ -38,17 +40,17 @@ public: // Construct from use_future special value. template< typename Allocator > promise_handler( boost::fibers::asio::use_future_t< Allocator > uf) : - promise_( std::make_shared< boost::fibers::promise< T > >( - uf.get_allocator(), std::allocator_arg, uf.get_allocator() ) ) + promise_( boost::make_shared< boost::fibers::promise< T > >( + uf.get_allocator(), boost::allocator_arg, uf.get_allocator() ) ) {} void operator()( T t) { promise_->set_value( t); - //boost::fibers::fm_run(); + //boost::fibers::detail::scheduler::instance()->run(); } - void operator()( std::error_code const& ec, T t) + void operator()( boost::system::error_code const& ec, T t) { if (ec) promise_->set_exception( @@ -59,7 +61,7 @@ public: // scheduler::run() resumes a ready fiber // invoke scheduler::run() until no fiber was resumed - //boost::fibers::fm_run(); + //boost::fibers::detail::scheduler::instance()->run(); } //private: @@ -81,7 +83,7 @@ public: void operator()() { promise_->set_value(); - //boost::fibers::fm_run(); + //boost::fibers::detail::scheduler::instance()->run(); } void operator()( boost::system::error_code const& ec) @@ -95,7 +97,7 @@ public: // scheduler::run() resumes a ready fiber // invoke scheduler::run() until no fiber was resumed - //boost::fibers::fm_run(); + //boost::fibers::detail::scheduler::instance()->run(); } //private: diff --git a/examples/asio/detail/yield.hpp b/examples/asio/detail/yield.hpp index 4025a48c..a06e41b4 100644 --- a/examples/asio/detail/yield.hpp +++ b/examples/asio/detail/yield.hpp @@ -24,7 +24,7 @@ class yield_handler { public: yield_handler( yield_t const& y) : - fiber_( boost::fibers::fm_active() ), + fiber_( boost::fibers::detail::scheduler::instance()->active() ), ec_( y.ec_), value_( 0) {} @@ -43,7 +43,7 @@ public: } //private: - boost::fibers::detail::fiber_base * fiber_; + boost::fibers::fiber_context * fiber_; boost::system::error_code * ec_; T * value_; }; @@ -54,7 +54,7 @@ class yield_handler< void > { public: yield_handler( yield_t const& y) : - fiber_( boost::fibers::fm_active() ), + fiber_( boost::fibers::detail::scheduler::instance()->active() ), ec_( y.ec_) {} @@ -71,7 +71,7 @@ public: } //private: - boost::fibers::detail::fiber_base * fiber_; + boost::fibers::fiber_context * fiber_; boost::system::error_code * ec_; }; @@ -100,7 +100,7 @@ public: { fibers::detail::spinlock splk; std::unique_lock< fibers::detail::spinlock > lk( splk); - boost::fibers::fm_wait(lk); + boost::fibers::detail::scheduler::instance()->wait(lk); if ( ! out_ec_ && ec_) throw_exception( boost::system::system_error( ec_) ); return value_; @@ -128,7 +128,7 @@ public: { fibers::detail::spinlock splk; std::unique_lock< fibers::detail::spinlock > lk( splk); - boost::fibers::fm_wait(lk); + boost::fibers::detail::scheduler::instance()->wait(lk); if ( ! out_ec_ && ec_) throw_exception( boost::system::system_error( ec_) ); } diff --git a/examples/asio/loop.hpp b/examples/asio/loop.hpp index 89319f32..de8bcfcf 100644 --- a/examples/asio/loop.hpp +++ b/examples/asio/loop.hpp @@ -4,14 +4,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - #include #include +#include #include -#include -#include +#include #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX @@ -22,13 +20,13 @@ namespace fibers { namespace asio { inline void timer_handler( boost::asio::high_resolution_timer & timer) { - boost::fibers::fm_yield(); - timer.expires_at( boost::fibers::fm_next_wakeup() ); + boost::fibers::detail::scheduler::instance()->yield(); + timer.expires_at( boost::fibers::detail::scheduler::instance()->next_wakeup() ); timer.async_wait( std::bind( timer_handler, std::ref( timer) ) ); } inline void run_service( boost::asio::io_service & io_service) { - boost::asio::high_resolution_timer timer( io_service, std::chrono::seconds(0) ); + boost::asio::high_resolution_timer timer( io_service, boost::chrono::seconds(0) ); timer.async_wait( std::bind( timer_handler, std::ref( timer) ) ); io_service.run(); } diff --git a/examples/asio/spawn.hpp b/examples/asio/spawn.hpp index d3ac3670..235a1171 100644 --- a/examples/asio/spawn.hpp +++ b/examples/asio/spawn.hpp @@ -18,7 +18,7 @@ #include #include -#include +#include #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX @@ -57,7 +57,7 @@ public: * function. */ basic_yield_context( - boost::fibers::detail::fiber_base * fib, + boost::fibers::fiber_context * fib, Handler& handler) : fiber_( fib), handler_( handler), @@ -93,7 +93,7 @@ public: #if defined(GENERATING_DOCUMENTATION) private: #endif // defined(GENERATING_DOCUMENTATION) - boost::fibers::detail::fiber_base * fiber_; + boost::fibers::fiber_context * fiber_; Handler & handler_; boost::system::error_code * ec_; };