update boost
This commit is contained in:
@@ -35,7 +35,7 @@ private:
|
||||
public:
|
||||
typedef intrusive_ptr< algorithm > ptr_t;
|
||||
|
||||
virtual ~algorithm() {}
|
||||
virtual ~algorithm() = default;
|
||||
|
||||
virtual void awakened( context *) noexcept = 0;
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
|
||||
virtual void notify() noexcept = 0;
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
friend void intrusive_ptr_add_ref( algorithm * algo) noexcept {
|
||||
BOOST_ASSERT( nullptr != algo);
|
||||
algo->use_count_.fetch_add( 1, std::memory_order_relaxed);
|
||||
@@ -59,8 +61,33 @@ public:
|
||||
delete algo;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
friend void intrusive_ptr_add_ref( algorithm * algo) noexcept;
|
||||
friend void intrusive_ptr_release( algorithm * algo) noexcept;
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#if defined(BOOST_EMBTC)
|
||||
|
||||
inline void intrusive_ptr_add_ref( algorithm * algo) noexcept {
|
||||
BOOST_ASSERT( nullptr != algo);
|
||||
algo->use_count_.fetch_add( 1, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
inline void intrusive_ptr_release( algorithm * algo) noexcept {
|
||||
BOOST_ASSERT( nullptr != algo);
|
||||
if ( 1 == algo->use_count_.fetch_sub( 1, std::memory_order_release) ) {
|
||||
std::atomic_thread_fence( std::memory_order_acquire);
|
||||
delete algo;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
class BOOST_FIBERS_DECL algorithm_with_properties_base : public algorithm {
|
||||
public:
|
||||
// called by fiber_properties::notify() -- don't directly call
|
||||
@@ -79,7 +106,7 @@ struct algorithm_with_properties : public algorithm_with_properties_base {
|
||||
// must override awakened() with properties parameter instead. Otherwise
|
||||
// you'd have to remember to start every subclass awakened() override
|
||||
// with: algorithm_with_properties<PROPS>::awakened(fb);
|
||||
virtual void awakened( context * ctx) noexcept override final {
|
||||
void awakened( context * ctx) noexcept final {
|
||||
fiber_properties * props = super::get_properties( ctx);
|
||||
if ( BOOST_LIKELY( nullptr == props) ) {
|
||||
// TODO: would be great if PROPS could be allocated on the new
|
||||
@@ -110,11 +137,11 @@ struct algorithm_with_properties : public algorithm_with_properties_base {
|
||||
}
|
||||
|
||||
// override this to be notified by PROPS::notify()
|
||||
virtual void property_change( context * ctx, PROPS & props) noexcept {
|
||||
virtual void property_change( context * /* ctx */, PROPS & /* props */) noexcept {
|
||||
}
|
||||
|
||||
// implementation for algorithm_with_properties_base method
|
||||
void property_change_( context * ctx, fiber_properties * props) noexcept override final {
|
||||
void property_change_( context * ctx, fiber_properties * props) noexcept final {
|
||||
property_change( ctx, * static_cast< PROPS * >( props) );
|
||||
}
|
||||
|
||||
|
||||
@@ -45,15 +45,15 @@ public:
|
||||
round_robin( round_robin const&) = delete;
|
||||
round_robin & operator=( round_robin const&) = delete;
|
||||
|
||||
virtual void awakened( context *) noexcept;
|
||||
void awakened( context *) noexcept override;
|
||||
|
||||
virtual context * pick_next() noexcept;
|
||||
context * pick_next() noexcept override;
|
||||
|
||||
virtual bool has_ready_fibers() const noexcept;
|
||||
bool has_ready_fibers() const noexcept override;
|
||||
|
||||
virtual void suspend_until( std::chrono::steady_clock::time_point const&) noexcept;
|
||||
void suspend_until( std::chrono::steady_clock::time_point const&) noexcept override;
|
||||
|
||||
virtual void notify() noexcept;
|
||||
void notify() noexcept override;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
@@ -59,18 +59,18 @@ public:
|
||||
shared_work & operator=( shared_work const&) = delete;
|
||||
shared_work & operator=( shared_work &&) = delete;
|
||||
|
||||
void awakened( context * ctx) noexcept;
|
||||
void awakened( context * ctx) noexcept override;
|
||||
|
||||
context * pick_next() noexcept;
|
||||
context * pick_next() noexcept override;
|
||||
|
||||
bool has_ready_fibers() const noexcept {
|
||||
bool has_ready_fibers() const noexcept override {
|
||||
std::unique_lock< std::mutex > lock{ rqueue_mtx_ };
|
||||
return ! rqueue_.empty() || ! lqueue_.empty();
|
||||
}
|
||||
|
||||
void suspend_until( std::chrono::steady_clock::time_point const& time_point) noexcept;
|
||||
void suspend_until( std::chrono::steady_clock::time_point const& time_point) noexcept override;
|
||||
|
||||
void notify() noexcept;
|
||||
void notify() noexcept override;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
@@ -62,21 +62,21 @@ public:
|
||||
work_stealing & operator=( work_stealing const&) = delete;
|
||||
work_stealing & operator=( work_stealing &&) = delete;
|
||||
|
||||
virtual void awakened( context *) noexcept;
|
||||
void awakened( context *) noexcept override;
|
||||
|
||||
virtual context * pick_next() noexcept;
|
||||
context * pick_next() noexcept override;
|
||||
|
||||
virtual context * steal() noexcept {
|
||||
return rqueue_.steal();
|
||||
}
|
||||
|
||||
virtual bool has_ready_fibers() const noexcept {
|
||||
bool has_ready_fibers() const noexcept override {
|
||||
return ! rqueue_.empty();
|
||||
}
|
||||
|
||||
virtual void suspend_until( std::chrono::steady_clock::time_point const&) noexcept;
|
||||
void suspend_until( std::chrono::steady_clock::time_point const&) noexcept override;
|
||||
|
||||
virtual void notify() noexcept;
|
||||
void notify() noexcept override;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
Reference in New Issue
Block a user