mirror of
https://github.com/boostorg/fiber.git
synced 2026-02-16 13:22:17 +00:00
fix data_t for MSVC 14 (initializer-list issue)
This commit is contained in:
@@ -25,7 +25,7 @@ namespace fibers {
|
||||
class context;
|
||||
|
||||
struct BOOST_FIBERS_DECL sched_algorithm {
|
||||
virtual ~sched_algorithm() noexcept {}
|
||||
virtual ~sched_algorithm() {}
|
||||
|
||||
virtual void awakened( context *) noexcept = 0;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ private:
|
||||
public:
|
||||
condition() = default;
|
||||
|
||||
~condition() noexcept {
|
||||
~condition() {
|
||||
BOOST_ASSERT( wait_queue_.empty() );
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ private:
|
||||
void * vp{ nullptr };
|
||||
detail::fss_cleanup_function::ptr_t cleanup_function{};
|
||||
|
||||
constexpr fss_data() noexcept = default;
|
||||
constexpr fss_data() = default;
|
||||
|
||||
fss_data( void * vp_,
|
||||
detail::fss_cleanup_function::ptr_t const& fn) noexcept :
|
||||
@@ -158,6 +158,16 @@ private:
|
||||
struct data_t {
|
||||
detail::spinlock_lock * lk{ nullptr };
|
||||
context * ctx{ nullptr };
|
||||
|
||||
constexpr data_t() = default;
|
||||
|
||||
explicit data_t( detail::spinlock_lock * lk_) noexcept :
|
||||
lk{ lk_ } {
|
||||
}
|
||||
|
||||
explicit data_t( context * ctx_) noexcept :
|
||||
ctx{ ctx_ } {
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map< uintptr_t, fss_data > fss_data_t;
|
||||
@@ -203,7 +213,7 @@ public:
|
||||
context * impl_{ nullptr };
|
||||
|
||||
public:
|
||||
constexpr id() noexcept = default;
|
||||
constexpr id() = default;
|
||||
|
||||
explicit id( context * impl) noexcept :
|
||||
impl_( impl) {
|
||||
@@ -293,7 +303,7 @@ public:
|
||||
}} {
|
||||
}
|
||||
|
||||
virtual ~context() noexcept;
|
||||
virtual ~context();
|
||||
|
||||
scheduler * get_scheduler() const noexcept;
|
||||
|
||||
@@ -437,7 +447,7 @@ public:
|
||||
|
||||
struct context_initializer {
|
||||
context_initializer();
|
||||
~context_initializer() noexcept;
|
||||
~context_initializer();
|
||||
};
|
||||
|
||||
template< typename StackAlloc, typename Fn, typename ... Args >
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
|
||||
fss_cleanup_function() noexcept = default;
|
||||
|
||||
virtual ~fss_cleanup_function() noexcept = default;
|
||||
virtual ~fss_cleanup_function() = default;
|
||||
|
||||
virtual void operator()( void * data) = 0;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ private:
|
||||
public:
|
||||
typedef context::id id;
|
||||
|
||||
constexpr fiber() noexcept = default;
|
||||
constexpr fiber() = default;
|
||||
|
||||
template< typename Fn, typename ... Args >
|
||||
fiber( Fn && fn, Args && ... args) :
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
start_();
|
||||
}
|
||||
|
||||
~fiber() noexcept {
|
||||
~fiber() {
|
||||
if ( joinable() ) {
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
cleanup_fn_{ new custom_cleanup_function( fn) } {
|
||||
}
|
||||
|
||||
~fiber_specific_ptr() noexcept {
|
||||
~fiber_specific_ptr() {
|
||||
context * f = context::active();
|
||||
if ( nullptr != f) {
|
||||
f->set_fss_data(
|
||||
|
||||
@@ -96,7 +96,7 @@ protected:
|
||||
public:
|
||||
shared_state_base() = default;
|
||||
|
||||
virtual ~shared_state_base() noexcept = default;
|
||||
virtual ~shared_state_base() = default;
|
||||
|
||||
shared_state_base( shared_state_base const&) = delete;
|
||||
shared_state_base & operator=( shared_state_base const&) = delete;
|
||||
@@ -184,7 +184,7 @@ public:
|
||||
|
||||
shared_state() = default;
|
||||
|
||||
virtual ~shared_state() noexcept {
|
||||
virtual ~shared_state() {
|
||||
if ( ready_) {
|
||||
reinterpret_cast< R const* >( storage_)->~R();
|
||||
}
|
||||
@@ -235,7 +235,7 @@ public:
|
||||
|
||||
shared_state() = default;
|
||||
|
||||
virtual ~shared_state() noexcept = default;
|
||||
virtual ~shared_state() = default;
|
||||
|
||||
shared_state( shared_state const&) = delete;
|
||||
shared_state & operator=( shared_state const&) = delete;
|
||||
@@ -275,7 +275,7 @@ public:
|
||||
|
||||
shared_state() = default;
|
||||
|
||||
virtual ~shared_state() noexcept = default;
|
||||
virtual ~shared_state() = default;
|
||||
|
||||
shared_state( shared_state const&) = delete;
|
||||
shared_state & operator=( shared_state const&) = delete;
|
||||
|
||||
@@ -24,7 +24,7 @@ template< typename R, typename ... Args >
|
||||
struct task_base : public shared_state< R > {
|
||||
typedef intrusive_ptr< task_base > ptr_t;
|
||||
|
||||
virtual ~task_base() noexcept {
|
||||
virtual ~task_base() {
|
||||
}
|
||||
|
||||
virtual void run( Args && ... args) = 0;
|
||||
|
||||
@@ -28,13 +28,13 @@ struct future_base {
|
||||
|
||||
ptr_t state_{};
|
||||
|
||||
constexpr future_base() noexcept = default;
|
||||
constexpr future_base() = default;
|
||||
|
||||
explicit future_base( ptr_t const& p) noexcept :
|
||||
state_{ p } {
|
||||
}
|
||||
|
||||
~future_base() noexcept = default;
|
||||
~future_base() = default;
|
||||
|
||||
future_base( future_base const& other) :
|
||||
state_{ other.state_ } {
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
friend class shared_future< R >;
|
||||
|
||||
public:
|
||||
constexpr future() noexcept = default;
|
||||
constexpr future() = default;
|
||||
|
||||
explicit future( typename base_t::ptr_t const& p) noexcept :
|
||||
base_t{ p } {
|
||||
@@ -159,7 +159,7 @@ private:
|
||||
friend class shared_future< R & >;
|
||||
|
||||
public:
|
||||
constexpr future() noexcept = default;
|
||||
constexpr future() = default;
|
||||
|
||||
explicit future( typename base_t::ptr_t const& p) noexcept :
|
||||
base_t{ p } {
|
||||
@@ -212,7 +212,7 @@ private:
|
||||
friend class shared_future< void >;
|
||||
|
||||
public:
|
||||
constexpr future() noexcept = default;
|
||||
constexpr future() = default;
|
||||
|
||||
explicit future( base_t::ptr_t const& p) noexcept :
|
||||
base_t{ p } {
|
||||
@@ -271,9 +271,9 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
constexpr shared_future() noexcept = default;
|
||||
constexpr shared_future() = default;
|
||||
|
||||
~shared_future() noexcept = default;
|
||||
~shared_future() = default;
|
||||
|
||||
shared_future( shared_future const& other) :
|
||||
base_t{ other } {
|
||||
@@ -336,9 +336,9 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
constexpr shared_future() noexcept = default;
|
||||
constexpr shared_future() = default;
|
||||
|
||||
~shared_future() noexcept = default;
|
||||
~shared_future() = default;
|
||||
|
||||
shared_future( shared_future const& other) :
|
||||
base_t{ other } {
|
||||
@@ -401,9 +401,9 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
constexpr shared_future() noexcept = default;
|
||||
constexpr shared_future() = default;
|
||||
|
||||
~shared_future() noexcept = default;
|
||||
~shared_future() = default;
|
||||
|
||||
inline
|
||||
shared_future( shared_future const& other) :
|
||||
|
||||
@@ -33,9 +33,9 @@ private:
|
||||
ptr_t task_{};
|
||||
|
||||
public:
|
||||
constexpr packaged_task() noexcept = default;
|
||||
constexpr packaged_task() = default;
|
||||
|
||||
~packaged_task() noexcept {
|
||||
~packaged_task() {
|
||||
if ( task_) {
|
||||
task_->owner_destroyed();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
::new( a.allocate( 1) ) object_t{ a } };
|
||||
}
|
||||
|
||||
~promise() noexcept {
|
||||
~promise() {
|
||||
if ( future_) {
|
||||
future_->owner_destroyed();
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
::new( a.allocate( 1) ) object_t{ a } };
|
||||
}
|
||||
|
||||
~promise() noexcept {
|
||||
~promise() {
|
||||
if ( future_) {
|
||||
future_->owner_destroyed();
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
::new( a.allocate( 1) ) object_t{ a } };
|
||||
}
|
||||
|
||||
~promise() noexcept {
|
||||
~promise() {
|
||||
if ( future_) {
|
||||
future_->owner_destroyed();
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ private:
|
||||
public:
|
||||
disable_interruption() noexcept;
|
||||
|
||||
~disable_interruption() noexcept;
|
||||
~disable_interruption();
|
||||
|
||||
disable_interruption( disable_interruption const&) = delete;
|
||||
disable_interruption & operator=( disable_interruption const&) = delete;
|
||||
@@ -44,7 +44,7 @@ private:
|
||||
public:
|
||||
explicit restore_interruption( disable_interruption & disabler) noexcept;
|
||||
|
||||
~restore_interruption() noexcept;
|
||||
~restore_interruption();
|
||||
|
||||
restore_interruption( restore_interruption const&) = delete;
|
||||
restore_interruption & operator=( restore_interruption const&) = delete;
|
||||
|
||||
@@ -37,7 +37,7 @@ private:
|
||||
public:
|
||||
mutex() = default;
|
||||
|
||||
~mutex() noexcept {
|
||||
~mutex() {
|
||||
BOOST_ASSERT( nullptr == owner_);
|
||||
BOOST_ASSERT( wait_queue_.empty() );
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
// We need a virtual destructor (hence a vtable) because fiber_properties
|
||||
// is stored polymorphically (as fiber_properties*) in context, and
|
||||
// destroyed via that pointer.
|
||||
virtual ~fiber_properties() noexcept = default;
|
||||
virtual ~fiber_properties() = default;
|
||||
|
||||
// not really intended for public use, but sched_algorithm_with_properties
|
||||
// must be able to call this
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
scheduler( scheduler const&) = delete;
|
||||
scheduler & operator=( scheduler const&) = delete;
|
||||
|
||||
virtual ~scheduler() noexcept;
|
||||
virtual ~scheduler();
|
||||
|
||||
void dispatch() noexcept;
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ context::resume( detail::spinlock_lock & lk) noexcept {
|
||||
// active_ will point to `this`
|
||||
// prev will point to previous active context
|
||||
std::swap( active_, prev);
|
||||
data_t d{ & lk, nullptr };
|
||||
data_t d{ & lk };
|
||||
resume_( d);
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ context::resume( context * ready_ctx) noexcept {
|
||||
// active_ will point to `this`
|
||||
// prev will point to previous active context
|
||||
std::swap( active_, prev);
|
||||
data_t d{ nullptr, ready_ctx };
|
||||
data_t d{ ready_ctx };
|
||||
resume_( d);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user