2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-11 11:42:23 +00:00

Start resolving build errors with newly-merged sched-props-dev branch.

Get fiber_manager out of the business of casting returned properties: that
introduces a circular dependency. Defer casting to fiber_properties subclass
to consumers in fiber.hpp and operations.hpp.
This commit is contained in:
Nat Goodspeed
2015-05-11 04:25:05 -04:00
parent 9c4cdf3438
commit 4eaed2a943
5 changed files with 4 additions and 19 deletions

View File

@@ -10,6 +10,7 @@
#include <boost/fiber/properties.hpp>
#include <boost/fiber/detail/config.hpp>
#include <boost/fiber/fiber_context.hpp>
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
@@ -17,7 +18,6 @@
namespace boost {
namespace fibers {
class fiber_context;
struct BOOST_FIBERS_DECL sched_algorithm {
virtual ~sched_algorithm() {}

View File

@@ -44,7 +44,7 @@ public:
fiber_context * top() const noexcept {
BOOST_ASSERT( ! empty() );
return static_cast<worker_fiber*>(head_);
return head_;
}
void move_to( sched_algorithm *);

View File

@@ -119,7 +119,7 @@ public:
template <class PROPS>
PROPS& properties()
{
return detail::scheduler::instance()->properties<PROPS>(impl_.get());
return dynamic_cast<PROPS&>(*impl_->get_properties());
}
};

View File

@@ -94,21 +94,6 @@ public:
std::chrono::high_resolution_clock::duration wait_interval() noexcept;
// implementation for fiber::properties<PROPS>()
template < class PROPS >
PROPS& properties( fiber_context * f )
{
return dynamic_cast<sched_algorithm_with_properties<PROPS>&>(*get_sched_algo_())
.properties(f);
}
// implementation for this_fiber::properties<PROPS>()
template < class PROPS >
PROPS& properties()
{
return properties<PROPS>(active());
}
void preserve_fpu( bool);
};

View File

@@ -52,7 +52,7 @@ void sleep_for( std::chrono::duration< Rep, Period > const& timeout_duration) {
template < class PROPS >
PROPS& properties()
{
return fibers::detail::scheduler::instance()->active()->properties<PROPS>();
return dynamic_cast<PROPS&>(*fibers::detail::scheduler::instance()->active()->get_properties());
}
} // this_fiber