update boost on linux

This commit is contained in:
Bassem Girgis
2019-08-10 16:06:25 -05:00
parent 76ad52be58
commit 861b918727
5363 changed files with 483306 additions and 116507 deletions

View File

@@ -30,7 +30,7 @@ future<
>::type( typename std::decay< Args >::type ... )
>::type
>
async( Fn && fn, Args && ... args) {
async( Fn && fn, Args ... args) {
typedef typename std::result_of<
typename std::decay< Fn >::type( typename std::decay< Args >::type ... )
>::type result_type;
@@ -51,7 +51,7 @@ future<
>::type( typename std::decay< Args >::type ...)
>::type
>
async( Policy policy, Fn && fn, Args && ... args) {
async( Policy policy, Fn && fn, Args ... args) {
typedef typename std::result_of<
typename std::decay< Fn >::type( typename std::decay< Args >::type ... )
>::type result_type;
@@ -72,7 +72,7 @@ future<
>::type( typename std::decay< Args >::type ... )
>::type
>
async( Policy policy, std::allocator_arg_t, StackAllocator salloc, Fn && fn, Args && ... args) {
async( Policy policy, std::allocator_arg_t, StackAllocator salloc, Fn && fn, Args ... args) {
typedef typename std::result_of<
typename std::decay< Fn >::type( typename std::decay< Args >::type ... )
>::type result_type;
@@ -94,7 +94,7 @@ future<
>::type( typename std::decay< Args >::type ... )
>::type
>
async( Policy policy, std::allocator_arg_t, StackAllocator salloc, Allocator alloc, Fn && fn, Args && ... args) {
async( Policy policy, std::allocator_arg_t, StackAllocator salloc, Allocator alloc, Fn && fn, Args ... args) {
typedef typename std::result_of<
typename std::decay< Fn >::type( typename std::decay< Args >::type ... )
>::type result_type;

View File

@@ -62,7 +62,7 @@ protected:
void set_exception_( std::exception_ptr except, std::unique_lock< mutex > & lk) {
BOOST_ASSERT( lk.owns_lock() );
if ( ready_) {
if ( BOOST_UNLIKELY( ready_) ) {
throw promise_already_satisfied();
}
except_ = except;
@@ -161,19 +161,19 @@ private:
void set_value_( R const& value, std::unique_lock< mutex > & lk) {
BOOST_ASSERT( lk.owns_lock() );
if ( ready_) {
if ( BOOST_UNLIKELY( ready_) ) {
throw promise_already_satisfied{};
}
::new ( static_cast< void * >( std::addressof( storage_) ) ) R{ value };
::new ( static_cast< void * >( std::addressof( storage_) ) ) R( value );
mark_ready_and_notify_( lk);
}
void set_value_( R && value, std::unique_lock< mutex > & lk) {
BOOST_ASSERT( lk.owns_lock() );
if ( ready_) {
if ( BOOST_UNLIKELY( ready_) ) {
throw promise_already_satisfied{};
}
::new ( static_cast< void * >( std::addressof( storage_) ) ) R{ std::move( value) };
::new ( static_cast< void * >( std::addressof( storage_) ) ) R( std::move( value) );
mark_ready_and_notify_( lk);
}
@@ -223,7 +223,7 @@ private:
void set_value_( R & value, std::unique_lock< mutex > & lk) {
BOOST_ASSERT( lk.owns_lock() );
if ( ready_) {
if ( BOOST_UNLIKELY( ready_) ) {
throw promise_already_satisfied();
}
value_ = std::addressof( value);
@@ -266,7 +266,7 @@ private:
inline
void set_value_( std::unique_lock< mutex > & lk) {
BOOST_ASSERT( lk.owns_lock() );
if ( ready_) {
if ( BOOST_UNLIKELY( ready_) ) {
throw promise_already_satisfied();
}
mark_ready_and_notify_( lk);

View File

@@ -44,8 +44,9 @@ private:
static void destroy_( allocator_type const& alloc, shared_state_object * p) noexcept {
allocator_type a{ alloc };
a.destroy( p);
a.deallocate( p, 1);
typedef std::allocator_traits< allocator_type > traity_type;
traity_type::destroy( a, p);
traity_type::deallocate( a, p, 1);
}
};

View File

@@ -13,9 +13,11 @@
#include <utility>
#include <boost/config.hpp>
#include <boost/context/detail/config.hpp>
#if defined(BOOST_NO_CXX17_STD_APPLY)
#include <boost/context/detail/apply.hpp>
#endif
#include <boost/core/pointer_traits.hpp>
#include <boost/fiber/detail/config.hpp>
#include <boost/fiber/future/detail/task_base.hpp>
@@ -32,9 +34,10 @@ template< typename Fn, typename Allocator, typename R, typename ... Args >
class task_object : public task_base< R, Args ... > {
private:
typedef task_base< R, Args ... > base_type;
typedef std::allocator_traits< Allocator > allocator_traits;
public:
typedef typename std::allocator_traits< Allocator >::template rebind_alloc<
typedef typename allocator_traits::template rebind_alloc<
task_object
> allocator_type;
@@ -61,6 +64,10 @@ public:
fn_, std::make_tuple( std::forward< Args >( args) ... ) )
#endif
);
#if defined(BOOST_CONTEXT_HAS_CXXABI_H)
} catch ( abi::__forced_unwind const&) {
throw;
#endif
} catch (...) {
this->set_exception( std::current_exception() );
}
@@ -68,15 +75,17 @@ public:
typename base_type::ptr_type reset() override final {
typedef std::allocator_traits< allocator_type > traity_type;
typedef pointer_traits< typename traity_type::pointer> ptrait_type;
typename traity_type::pointer ptr{ traity_type::allocate( alloc_, 1) };
typename ptrait_type::element_type* p = boost::to_address(ptr);
try {
traity_type::construct( alloc_, ptr, alloc_, std::move( fn_) );
traity_type::construct( alloc_, p, alloc_, std::move( fn_) );
} catch (...) {
traity_type::deallocate( alloc_, ptr, 1);
throw;
}
return { convert( ptr) };
return { p };
}
protected:
@@ -90,8 +99,9 @@ private:
static void destroy_( allocator_type const& alloc, task_object * p) noexcept {
allocator_type a{ alloc };
a.destroy( p);
a.deallocate( p, 1);
typedef std::allocator_traits< allocator_type > traity_type;
traity_type::destroy( a, p);
traity_type::deallocate( a, p, 1);
}
};
@@ -99,11 +109,12 @@ template< typename Fn, typename Allocator, typename ... Args >
class task_object< Fn, Allocator, void, Args ... > : public task_base< void, Args ... > {
private:
typedef task_base< void, Args ... > base_type;
typedef std::allocator_traits< Allocator > allocator_traits;
public:
typedef typename Allocator::template rebind<
typedef typename allocator_traits::template rebind_alloc<
task_object< Fn, Allocator, void, Args ... >
>::other allocator_type;
> allocator_type;
task_object( allocator_type const& alloc, Fn const& fn) :
base_type{},
@@ -127,6 +138,10 @@ public:
fn_, std::make_tuple( std::forward< Args >( args) ... ) );
#endif
this->set_value();
#if defined(BOOST_CONTEXT_HAS_CXXABI_H)
} catch ( abi::__forced_unwind const&) {
throw;
#endif
} catch (...) {
this->set_exception( std::current_exception() );
}
@@ -134,15 +149,17 @@ public:
typename base_type::ptr_type reset() override final {
typedef std::allocator_traits< allocator_type > traity_type;
typedef pointer_traits< typename traity_type::pointer> ptrait_type;
typename traity_type::pointer ptr{ traity_type::allocate( alloc_, 1) };
typename ptrait_type::element_type* p = boost::to_address(ptr);
try {
traity_type::construct( alloc_, ptr, alloc_, std::move( fn_) );
traity_type::construct( alloc_, p, alloc_, std::move( fn_) );
} catch (...) {
traity_type::deallocate( alloc_, ptr, 1);
throw;
}
return { convert( ptr) };
return { p };
}
protected:
@@ -156,8 +173,9 @@ private:
static void destroy_( allocator_type const& alloc, task_object * p) noexcept {
allocator_type a{ alloc };
a.destroy( p);
a.deallocate( p, 1);
typedef std::allocator_traits< allocator_type > traity_type;
traity_type::destroy( a, p);
traity_type::deallocate( a, p, 1);
}
};

View File

@@ -46,14 +46,14 @@ struct future_base {
}
future_base & operator=( future_base const& other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
state_ = other.state_;
}
return * this;
}
future_base & operator=( future_base && other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
state_ = other.state_;
other.state_.reset();
}
@@ -65,14 +65,14 @@ struct future_base {
}
std::exception_ptr get_exception_ptr() {
if ( ! valid() ) {
if ( BOOST_UNLIKELY( ! valid() ) ) {
throw future_uninitialized{};
}
return state_->get_exception_ptr();
}
void wait() const {
if ( ! valid() ) {
if ( BOOST_UNLIKELY( ! valid() ) ) {
throw future_uninitialized{};
}
state_->wait();
@@ -80,7 +80,7 @@ struct future_base {
template< typename Rep, typename Period >
future_status wait_for( std::chrono::duration< Rep, Period > const& timeout_duration) const {
if ( ! valid() ) {
if ( BOOST_UNLIKELY( ! valid() ) ) {
throw future_uninitialized{};
}
return state_->wait_for( timeout_duration);
@@ -88,7 +88,7 @@ struct future_base {
template< typename Clock, typename Duration >
future_status wait_until( std::chrono::time_point< Clock, Duration > const& timeout_time) const {
if ( ! valid() ) {
if ( BOOST_UNLIKELY( ! valid() ) ) {
throw future_uninitialized{};
}
return state_->wait_until( timeout_time);
@@ -131,7 +131,7 @@ public:
}
future & operator=( future && other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
base_type::operator=( std::move( other) );
}
return * this;
@@ -140,7 +140,7 @@ public:
shared_future< R > share();
R get() {
if ( ! base_type::valid() ) {
if ( BOOST_UNLIKELY( ! base_type::valid() ) ) {
throw future_uninitialized{};
}
typename base_type::ptr_type tmp{};
@@ -180,7 +180,7 @@ public:
}
future & operator=( future && other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
base_type::operator=( std::move( other) );
}
return * this;
@@ -189,7 +189,7 @@ public:
shared_future< R & > share();
R & get() {
if ( ! base_type::valid() ) {
if ( BOOST_UNLIKELY( ! base_type::valid() ) ) {
throw future_uninitialized{};
}
typename base_type::ptr_type tmp{};
@@ -231,7 +231,7 @@ public:
inline
future & operator=( future && other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
base_type::operator=( std::move( other) );
}
return * this;
@@ -241,7 +241,7 @@ public:
inline
void get() {
if ( ! base_type::valid() ) {
if ( BOOST_UNLIKELY( ! base_type::valid() ) ) {
throw future_uninitialized{};
}
base_type::ptr_type tmp{};
@@ -284,14 +284,14 @@ public:
}
shared_future & operator=( shared_future const& other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
base_type::operator=( other);
}
return * this;
}
shared_future & operator=( shared_future && other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
base_type::operator=( std::move( other) );
}
return * this;
@@ -303,7 +303,7 @@ public:
}
R const& get() const {
if ( ! valid() ) {
if ( BOOST_UNLIKELY( ! valid() ) ) {
throw future_uninitialized{};
}
return base_type::state_->get();
@@ -343,14 +343,14 @@ public:
}
shared_future & operator=( shared_future const& other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
base_type::operator=( other);
}
return * this;
}
shared_future & operator=( shared_future && other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
base_type::operator=( std::move( other) );
}
return * this;
@@ -362,7 +362,7 @@ public:
}
R & get() const {
if ( ! valid() ) {
if ( BOOST_UNLIKELY( ! valid() ) ) {
throw future_uninitialized{};
}
return base_type::state_->get();
@@ -406,7 +406,7 @@ public:
inline
shared_future & operator=( shared_future const& other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
base_type::operator=( other);
}
return * this;
@@ -414,7 +414,7 @@ public:
inline
shared_future & operator=( shared_future && other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
base_type::operator=( std::move( other) );
}
return * this;
@@ -428,7 +428,7 @@ public:
inline
void get() const {
if ( ! valid() ) {
if ( BOOST_UNLIKELY( ! valid() ) ) {
throw future_uninitialized{};
}
base_type::state_->get();
@@ -445,7 +445,7 @@ public:
template< typename R >
shared_future< R >
future< R >::share() {
if ( ! base_type::valid() ) {
if ( BOOST_UNLIKELY( ! base_type::valid() ) ) {
throw future_uninitialized{};
}
return shared_future< R >{ std::move( * this) };
@@ -454,7 +454,7 @@ future< R >::share() {
template< typename R >
shared_future< R & >
future< R & >::share() {
if ( ! base_type::valid() ) {
if ( BOOST_UNLIKELY( ! base_type::valid() ) ) {
throw future_uninitialized{};
}
return shared_future< R & >{ std::move( * this) };
@@ -463,7 +463,7 @@ future< R & >::share() {
inline
shared_future< void >
future< void >::share() {
if ( ! base_type::valid() ) {
if ( BOOST_UNLIKELY( ! base_type::valid() ) ) {
throw future_uninitialized{};
}
return shared_future< void >{ std::move( * this) };

View File

@@ -14,7 +14,6 @@
#include <boost/config.hpp>
#include <boost/fiber/detail/convert.hpp>
#include <boost/fiber/detail/disable_overload.hpp>
#include <boost/fiber/exceptions.hpp>
#include <boost/fiber/future/detail/task_base.hpp>
@@ -57,20 +56,22 @@ public:
typedef std::allocator_traits<
typename object_type::allocator_type
> traits_type;
typedef pointer_traits< typename traits_type::pointer > ptrait_type;
typename object_type::allocator_type a{ alloc };
typename traits_type::pointer ptr{ traits_type::allocate( a, 1) };
typename ptrait_type::element_type* p = boost::to_address(ptr);
try {
traits_type::construct( a, ptr, a, std::forward< Fn >( fn) );
traits_type::construct( a, p, a, std::forward< Fn >( fn) );
} catch (...) {
traits_type::deallocate( a, ptr, 1);
throw;
}
task_.reset( convert( ptr) );
task_.reset(p);
}
~packaged_task() {
if ( task_) {
if ( task_ && obtained_) {
task_->owner_destroyed();
}
}
@@ -85,7 +86,7 @@ public:
}
packaged_task & operator=( packaged_task && other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
packaged_task tmp{ std::move( other) };
swap( tmp);
}
@@ -105,7 +106,7 @@ public:
if ( obtained_) {
throw future_already_retrieved{};
}
if ( ! valid() ) {
if ( BOOST_UNLIKELY( ! valid() ) ) {
throw packaged_task_uninitialized{};
}
obtained_ = true;
@@ -114,14 +115,14 @@ public:
}
void operator()( Args ... args) {
if ( ! valid() ) {
if ( BOOST_UNLIKELY( ! valid() ) ) {
throw packaged_task_uninitialized{};
}
task_->run( std::forward< Args >( args) ... );
}
void reset() {
if ( ! valid() ) {
if ( BOOST_UNLIKELY( ! valid() ) ) {
throw packaged_task_uninitialized{};
}
packaged_task tmp;

View File

@@ -12,8 +12,8 @@
#include <utility>
#include <boost/config.hpp>
#include <boost/core/pointer_traits.hpp>
#include <boost/fiber/detail/convert.hpp>
#include <boost/fiber/exceptions.hpp>
#include <boost/fiber/future/detail/shared_state.hpp>
#include <boost/fiber/future/detail/shared_state_object.hpp>
@@ -38,20 +38,22 @@ struct promise_base {
promise_base( std::allocator_arg_t, Allocator alloc) {
typedef detail::shared_state_object< R, Allocator > object_type;
typedef std::allocator_traits< typename object_type::allocator_type > traits_type;
typedef pointer_traits< typename traits_type::pointer > ptrait_type;
typename object_type::allocator_type a{ alloc };
typename traits_type::pointer ptr{ traits_type::allocate( a, 1) };
typename ptrait_type::element_type* p = boost::to_address(ptr);
try {
traits_type::construct( a, ptr, a);
traits_type::construct( a, p, a);
} catch (...) {
traits_type::deallocate( a, ptr, 1);
throw;
}
future_.reset( convert( ptr) );
future_.reset(p);
}
~promise_base() {
if ( future_) {
if ( future_ && obtained_) {
future_->owner_destroyed();
}
}
@@ -66,7 +68,7 @@ struct promise_base {
}
promise_base & operator=( promise_base && other) noexcept {
if ( this != & other) {
if ( BOOST_LIKELY( this != & other) ) {
promise_base tmp{ std::move( other) };
swap( tmp);
}
@@ -74,10 +76,10 @@ struct promise_base {
}
future< R > get_future() {
if ( obtained_) {
if ( BOOST_UNLIKELY( obtained_) ) {
throw future_already_retrieved{};
}
if ( ! future_) {
if ( BOOST_UNLIKELY( ! future_) ) {
throw promise_uninitialized{};
}
obtained_ = true;
@@ -90,7 +92,7 @@ struct promise_base {
}
void set_exception( std::exception_ptr p) {
if ( ! future_) {
if ( BOOST_UNLIKELY( ! future_) ) {
throw promise_uninitialized{};
}
future_->set_exception( p);
@@ -119,14 +121,14 @@ public:
promise & operator=( promise && other) = default;
void set_value( R const& value) {
if ( ! base_type::future_) {
if ( BOOST_UNLIKELY( ! base_type::future_) ) {
throw promise_uninitialized{};
}
base_type::future_->set_value( value);
}
void set_value( R && value) {
if ( ! base_type::future_) {
if ( BOOST_UNLIKELY( ! base_type::future_) ) {
throw promise_uninitialized{};
}
base_type::future_->set_value( std::move( value) );
@@ -160,7 +162,7 @@ public:
promise & operator=( promise && other) noexcept = default;
void set_value( R & value) {
if ( ! base_type::future_) {
if ( BOOST_UNLIKELY( ! base_type::future_) ) {
throw promise_uninitialized{};
}
base_type::future_->set_value( value);
@@ -195,7 +197,7 @@ public:
inline
void set_value() {
if ( ! base_type::future_) {
if ( BOOST_UNLIKELY( ! base_type::future_) ) {
throw promise_uninitialized{};
}
base_type::future_->set_value();