update boost
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/utility/explicit_operator_bool.hpp>
|
||||
|
||||
@@ -2362,41 +2361,48 @@ struct coroutine
|
||||
template< typename R >
|
||||
typename pull_coroutine< R >::iterator
|
||||
begin( pull_coroutine< R > & c)
|
||||
{ return boost::begin( c); }
|
||||
{ return coroutines::range_begin( c); }
|
||||
|
||||
template< typename R >
|
||||
typename pull_coroutine< R >::const_iterator
|
||||
begin( pull_coroutine< R > const& c)
|
||||
{ return boost::begin( c); }
|
||||
{ return coroutines::range_begin( c); }
|
||||
|
||||
template< typename R >
|
||||
typename pull_coroutine< R >::iterator
|
||||
end( pull_coroutine< R > & c)
|
||||
{ return boost::end( c); }
|
||||
{ return coroutines::range_end( c); }
|
||||
|
||||
template< typename R >
|
||||
typename pull_coroutine< R >::const_iterator
|
||||
end( pull_coroutine< R > const& c)
|
||||
{ return boost::end( c); }
|
||||
{ return coroutines::range_end( c); }
|
||||
|
||||
template< typename R >
|
||||
typename push_coroutine< R >::iterator
|
||||
begin( push_coroutine< R > & c)
|
||||
{ return boost::begin( c); }
|
||||
{ return coroutines::range_begin( c); }
|
||||
|
||||
template< typename R >
|
||||
typename push_coroutine< R >::iterator
|
||||
end( push_coroutine< R > & c)
|
||||
{ return boost::end( c); }
|
||||
{ return coroutines::range_end( c); }
|
||||
|
||||
}
|
||||
|
||||
// forward declaration of Boost.Range traits to break dependency on it
|
||||
template<typename C, typename Enabler>
|
||||
struct range_mutable_iterator;
|
||||
|
||||
template<typename C, typename Enabler>
|
||||
struct range_const_iterator;
|
||||
|
||||
template< typename Arg >
|
||||
struct range_mutable_iterator< coroutines::push_coroutine< Arg > >
|
||||
struct range_mutable_iterator< coroutines::push_coroutine< Arg >, void >
|
||||
{ typedef typename coroutines::push_coroutine< Arg >::iterator type; };
|
||||
|
||||
template< typename R >
|
||||
struct range_mutable_iterator< coroutines::pull_coroutine< R > >
|
||||
struct range_mutable_iterator< coroutines::pull_coroutine< R >, void >
|
||||
{ typedef typename coroutines::pull_coroutine< R >::iterator type; };
|
||||
|
||||
}
|
||||
|
||||
@@ -38,4 +38,9 @@
|
||||
#define BOOST_COROUTINES_UNIDIRECT
|
||||
#define BOOST_COROUTINES_SYMMETRIC
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
// stacks need mmap(2) with MAP_STACK
|
||||
# define BOOST_COROUTINES_USE_MAP_STACK
|
||||
#endif
|
||||
|
||||
#endif // BOOST_COROUTINES_DETAIL_CONFIG_H
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <string>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/scoped_enum_emulation.hpp>
|
||||
#include <boost/core/scoped_enum.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/system/system_error.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
|
||||
@@ -22,6 +22,12 @@
|
||||
#include <boost/coroutine/stack_context.hpp>
|
||||
#include <boost/coroutine/stack_traits.hpp>
|
||||
|
||||
#if defined(BOOST_COROUTINES_USE_MAP_STACK)
|
||||
extern "C" {
|
||||
#include <sys/mman.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
@@ -39,8 +45,13 @@ struct basic_standard_stack_allocator
|
||||
BOOST_ASSERT( traits_type::minimum_size() <= size);
|
||||
BOOST_ASSERT( traits_type::is_unbounded() || ( traits_type::maximum_size() >= size) );
|
||||
|
||||
#if defined(BOOST_COROUTINES_USE_MAP_STACK)
|
||||
void * limit = ::mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_STACK, -1, 0);
|
||||
if ( limit == MAP_FAILED ) throw std::bad_alloc();
|
||||
#else
|
||||
void * limit = std::malloc( size);
|
||||
if ( ! limit) throw std::bad_alloc();
|
||||
#endif
|
||||
|
||||
ctx.size = size;
|
||||
ctx.sp = static_cast< char * >( limit) + ctx.size;
|
||||
@@ -60,7 +71,11 @@ struct basic_standard_stack_allocator
|
||||
#endif
|
||||
|
||||
void * limit = static_cast< char * >( ctx.sp) - ctx.size;
|
||||
#if defined(BOOST_COROUTINES_USE_MAP_STACK)
|
||||
munmap(limit, ctx.size);
|
||||
#else
|
||||
std::free( limit);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user