mirror of
https://github.com/boostorg/thread.git
synced 2026-02-03 09:42:16 +00:00
Compare commits
2 Commits
boost-1.88
...
feature/as
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e427659a4 | ||
|
|
c108444e78 |
@@ -94,6 +94,9 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
struct executor_arg_t {};
|
||||
|
||||
template <class T>
|
||||
shared_ptr<T> static_shared_from_this(T* that)
|
||||
{
|
||||
@@ -160,7 +163,6 @@ namespace boost
|
||||
boost::function<void()> callback;
|
||||
// This declaration should be only included conditionally, but is included to maintain the same layout.
|
||||
continuations_type continuations;
|
||||
executor_ptr_type ex;
|
||||
|
||||
// This declaration should be only included conditionally, but is included to maintain the same layout.
|
||||
virtual void launch_continuation()
|
||||
@@ -173,44 +175,26 @@ namespace boost
|
||||
is_deferred_(false),
|
||||
is_constructed(false),
|
||||
policy_(launch::none),
|
||||
continuations(),
|
||||
ex()
|
||||
continuations()
|
||||
{}
|
||||
|
||||
shared_state_base(exceptional_ptr const& ex):
|
||||
exception(ex.ptr_),
|
||||
shared_state_base(exceptional_ptr const& excp):
|
||||
exception(excp.ptr_),
|
||||
done(true),
|
||||
is_valid_(true),
|
||||
is_deferred_(false),
|
||||
is_constructed(false),
|
||||
policy_(launch::none),
|
||||
continuations(),
|
||||
ex()
|
||||
continuations()
|
||||
{}
|
||||
|
||||
|
||||
virtual ~shared_state_base()
|
||||
{
|
||||
}
|
||||
executor_ptr_type get_executor()
|
||||
virtual executor_ptr_type get_executor_ptr(boost::unique_lock<boost::mutex>&)
|
||||
{
|
||||
return ex;
|
||||
}
|
||||
|
||||
void set_executor_policy(executor_ptr_type aex)
|
||||
{
|
||||
set_executor();
|
||||
ex = aex;
|
||||
}
|
||||
void set_executor_policy(executor_ptr_type aex, boost::lock_guard<boost::mutex>&)
|
||||
{
|
||||
set_executor();
|
||||
ex = aex;
|
||||
}
|
||||
void set_executor_policy(executor_ptr_type aex, boost::unique_lock<boost::mutex>&)
|
||||
{
|
||||
set_executor();
|
||||
ex = aex;
|
||||
return executor_ptr_type();
|
||||
}
|
||||
|
||||
bool valid(boost::unique_lock<boost::mutex>&) { return is_valid_; }
|
||||
@@ -532,8 +516,8 @@ namespace boost
|
||||
shared_state():
|
||||
result()
|
||||
{}
|
||||
shared_state(exceptional_ptr const& ex):
|
||||
detail::shared_state_base(ex), result()
|
||||
shared_state(exceptional_ptr const& excp):
|
||||
detail::shared_state_base(excp), result()
|
||||
{}
|
||||
|
||||
|
||||
@@ -678,8 +662,8 @@ namespace boost
|
||||
result(0)
|
||||
{}
|
||||
|
||||
shared_state(exceptional_ptr const& ex):
|
||||
detail::shared_state_base(ex), result(0)
|
||||
shared_state(exceptional_ptr const& excp):
|
||||
detail::shared_state_base(excp), result(0)
|
||||
{}
|
||||
|
||||
~shared_state()
|
||||
@@ -745,8 +729,8 @@ namespace boost
|
||||
shared_state()
|
||||
{}
|
||||
|
||||
shared_state(exceptional_ptr const& ex):
|
||||
detail::shared_state_base(ex)
|
||||
shared_state(exceptional_ptr const& excp):
|
||||
detail::shared_state_base(excp)
|
||||
{}
|
||||
|
||||
void mark_finished_with_result_internal(boost::unique_lock<boost::mutex>& lock)
|
||||
@@ -795,6 +779,40 @@ namespace boost
|
||||
shared_state& operator=(shared_state const&);
|
||||
};
|
||||
|
||||
template <typename T, typename Executor>
|
||||
struct executor_shared_state: shared_state<T> {
|
||||
typedef Executor executor_type;
|
||||
executor_type& ex;
|
||||
executor_ptr_type ex_ptr;
|
||||
|
||||
executor_shared_state(Executor& ex):
|
||||
shared_state<T>(),
|
||||
ex(ex)
|
||||
{
|
||||
this->set_executor();
|
||||
}
|
||||
executor_shared_state(Executor& ex, exceptional_ptr const& excp):
|
||||
shared_state<T>(excp),
|
||||
ex(ex)
|
||||
{
|
||||
this->set_executor();
|
||||
}
|
||||
|
||||
executor_type& get_executor()
|
||||
{
|
||||
return ex;
|
||||
}
|
||||
|
||||
executor_ptr_type get_executor_ptr(boost::unique_lock<boost::mutex>&)
|
||||
{
|
||||
if (! ex_ptr)
|
||||
{
|
||||
ex_ptr.reset(new executor_ref<Executor>(ex));
|
||||
}
|
||||
return ex_ptr;
|
||||
}
|
||||
};
|
||||
|
||||
/////////////////////////
|
||||
/// future_async_shared_state_base
|
||||
/////////////////////////
|
||||
@@ -1227,8 +1245,8 @@ namespace boost
|
||||
typedef typename detail::shared_state<R>::move_dest_type move_dest_type;
|
||||
|
||||
static //BOOST_CONSTEXPR
|
||||
future_ptr make_exceptional_future_ptr(exceptional_ptr const& ex) {
|
||||
return future_ptr(new detail::shared_state<R>(ex));
|
||||
future_ptr make_exceptional_future_ptr(exceptional_ptr const& excp) {
|
||||
return future_ptr(new detail::shared_state<R>(excp));
|
||||
}
|
||||
|
||||
future_ptr future_;
|
||||
@@ -1246,8 +1264,8 @@ namespace boost
|
||||
|
||||
|
||||
//BOOST_CONSTEXPR
|
||||
basic_future(exceptional_ptr const& ex)
|
||||
: future_(make_exceptional_future_ptr(ex))
|
||||
basic_future(exceptional_ptr const& excp)
|
||||
: future_(make_exceptional_future_ptr(excp))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1607,8 +1625,8 @@ namespace boost
|
||||
|
||||
BOOST_CONSTEXPR BOOST_THREAD_FUTURE() {}
|
||||
//BOOST_CONSTEXPR
|
||||
BOOST_THREAD_FUTURE(exceptional_ptr const& ex):
|
||||
base_type(ex) {}
|
||||
BOOST_THREAD_FUTURE(exceptional_ptr const& excp):
|
||||
base_type(excp) {}
|
||||
|
||||
~BOOST_THREAD_FUTURE() {
|
||||
}
|
||||
@@ -1865,8 +1883,8 @@ namespace boost
|
||||
|
||||
BOOST_CONSTEXPR BOOST_THREAD_FUTURE() {}
|
||||
//BOOST_CONSTEXPR
|
||||
BOOST_THREAD_FUTURE(exceptional_ptr const& ex):
|
||||
base_type(ex) {}
|
||||
BOOST_THREAD_FUTURE(exceptional_ptr const& excp):
|
||||
base_type(excp) {}
|
||||
|
||||
~BOOST_THREAD_FUTURE() {
|
||||
}
|
||||
@@ -2031,8 +2049,8 @@ namespace boost
|
||||
BOOST_CONSTEXPR shared_future()
|
||||
{}
|
||||
//BOOST_CONSTEXPR
|
||||
shared_future(exceptional_ptr const& ex):
|
||||
base_type(ex) {}
|
||||
shared_future(exceptional_ptr const& excp):
|
||||
base_type(excp) {}
|
||||
~shared_future()
|
||||
{}
|
||||
|
||||
@@ -2153,6 +2171,15 @@ namespace boost
|
||||
future_obtained = false;
|
||||
}
|
||||
#endif
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
template <class Executor>
|
||||
promise(boost::executor_arg_t, Executor& ex):
|
||||
future_(new detail::executor_shared_state<R, Executor>(ex)),
|
||||
future_obtained(false)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
promise():
|
||||
#if defined BOOST_THREAD_PROVIDES_PROMISE_LAZY
|
||||
future_(),
|
||||
@@ -2197,18 +2224,6 @@ namespace boost
|
||||
std::swap(future_obtained,other.future_obtained);
|
||||
}
|
||||
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
void set_executor(executor_ptr_type aex)
|
||||
{
|
||||
lazy_init();
|
||||
if (future_.get()==0)
|
||||
{
|
||||
boost::throw_exception(promise_moved());
|
||||
}
|
||||
boost::lock_guard<boost::mutex> lk(future_->mutex);
|
||||
future_->set_executor_policy(aex, lk);
|
||||
}
|
||||
#endif
|
||||
// Result retrieval
|
||||
BOOST_THREAD_FUTURE<R> get_future()
|
||||
{
|
||||
@@ -2291,9 +2306,9 @@ namespace boost
|
||||
future_->mark_exceptional_finish_internal(p, lock);
|
||||
}
|
||||
template <typename E>
|
||||
void set_exception(E ex)
|
||||
void set_exception(E excp)
|
||||
{
|
||||
set_exception(boost::copy_exception(ex));
|
||||
set_exception(boost::copy_exception(excp));
|
||||
}
|
||||
// setting the result with deferred notification
|
||||
#if defined BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
@@ -2333,9 +2348,9 @@ namespace boost
|
||||
future_->set_exception_at_thread_exit(e);
|
||||
}
|
||||
template <typename E>
|
||||
void set_exception_at_thread_exit(E ex)
|
||||
void set_exception_at_thread_exit(E excp)
|
||||
{
|
||||
set_exception_at_thread_exit(boost::copy_exception(ex));
|
||||
set_exception_at_thread_exit(boost::copy_exception(excp));
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
@@ -2381,6 +2396,14 @@ namespace boost
|
||||
future_ = future_ptr(::new(a2.allocate(1)) detail::shared_state<R&>(), D(a2, 1) );
|
||||
future_obtained = false;
|
||||
}
|
||||
#endif
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
template <class Executor>
|
||||
promise(boost::executor_arg_t, Executor& ex):
|
||||
future_(new detail::executor_shared_state<R&, Executor>(ex)),
|
||||
future_obtained(false)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
promise():
|
||||
#if defined BOOST_THREAD_PROVIDES_PROMISE_LAZY
|
||||
@@ -2464,9 +2487,9 @@ namespace boost
|
||||
future_->mark_exceptional_finish_internal(p, lock);
|
||||
}
|
||||
template <typename E>
|
||||
void set_exception(E ex)
|
||||
void set_exception(E excp)
|
||||
{
|
||||
set_exception(boost::copy_exception(ex));
|
||||
set_exception(boost::copy_exception(excp));
|
||||
}
|
||||
|
||||
// setting the result with deferred notification
|
||||
@@ -2488,9 +2511,9 @@ namespace boost
|
||||
future_->set_exception_at_thread_exit(e);
|
||||
}
|
||||
template <typename E>
|
||||
void set_exception_at_thread_exit(E ex)
|
||||
void set_exception_at_thread_exit(E excp)
|
||||
{
|
||||
set_exception_at_thread_exit(boost::copy_exception(ex));
|
||||
set_exception_at_thread_exit(boost::copy_exception(excp));
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
@@ -2533,6 +2556,14 @@ namespace boost
|
||||
future_ = future_ptr(::new(a2.allocate(1)) detail::shared_state<void>(), D(a2, 1) );
|
||||
future_obtained = false;
|
||||
}
|
||||
#endif
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
template <class Executor>
|
||||
promise(boost::executor_arg_t, Executor& ex):
|
||||
future_(new detail::executor_shared_state<void, Executor>(ex)),
|
||||
future_obtained(false)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
promise():
|
||||
#if defined BOOST_THREAD_PROVIDES_PROMISE_LAZY
|
||||
@@ -2620,9 +2651,9 @@ namespace boost
|
||||
future_->mark_exceptional_finish_internal(p,lock);
|
||||
}
|
||||
template <typename E>
|
||||
void set_exception(E ex)
|
||||
void set_exception(E excp)
|
||||
{
|
||||
set_exception(boost::copy_exception(ex));
|
||||
set_exception(boost::copy_exception(excp));
|
||||
}
|
||||
|
||||
// setting the result with deferred notification
|
||||
@@ -2644,9 +2675,9 @@ namespace boost
|
||||
future_->set_exception_at_thread_exit(e);
|
||||
}
|
||||
template <typename E>
|
||||
void set_exception_at_thread_exit(E ex)
|
||||
void set_exception_at_thread_exit(E excp)
|
||||
{
|
||||
set_exception_at_thread_exit(boost::copy_exception(ex));
|
||||
set_exception_at_thread_exit(boost::copy_exception(excp));
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
@@ -3469,15 +3500,6 @@ namespace boost
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
void set_executor(executor_ptr_type aex)
|
||||
{
|
||||
if (!valid())
|
||||
boost::throw_exception(task_moved());
|
||||
boost::lock_guard<boost::mutex> lk(task->mutex);
|
||||
task->set_executor_policy(aex, lk);
|
||||
}
|
||||
#endif
|
||||
void reset() {
|
||||
if (!valid())
|
||||
boost::throw_exception(future_error(system::make_error_code(future_errc::no_state)));
|
||||
@@ -3844,22 +3866,21 @@ namespace detail {
|
||||
/////////////////////////
|
||||
/// future_executor_shared_state_base
|
||||
/////////////////////////
|
||||
template<typename Rp>
|
||||
struct future_executor_shared_state: shared_state<Rp>
|
||||
template<typename Rp, typename Ex>
|
||||
struct future_executor_shared_state: executor_shared_state<Rp, Ex>
|
||||
{
|
||||
typedef shared_state<Rp> base_type;
|
||||
typedef executor_shared_state<Rp, Ex> base_type;
|
||||
protected:
|
||||
public:
|
||||
future_executor_shared_state() {
|
||||
future_executor_shared_state(Ex& ex) : base_type(ex) {
|
||||
}
|
||||
|
||||
template <class Fp, class Executor>
|
||||
void init(Executor& ex, BOOST_THREAD_FWD_REF(Fp) f)
|
||||
template <class Fp>
|
||||
void init(BOOST_THREAD_FWD_REF(Fp) f)
|
||||
{
|
||||
typedef typename decay<Fp>::type Cont;
|
||||
this->set_executor_policy(executor_ptr_type(new executor_ref<Executor>(ex)));
|
||||
shared_state_nullary_task<Rp,Cont> t(this->shared_from_this(), boost::forward<Fp>(f));
|
||||
ex.submit(boost::move(t));
|
||||
this->ex.submit(boost::move(t));
|
||||
}
|
||||
|
||||
~future_executor_shared_state() {}
|
||||
@@ -3871,9 +3892,9 @@ namespace detail {
|
||||
template <class Rp, class Fp, class Executor>
|
||||
BOOST_THREAD_FUTURE<Rp>
|
||||
make_future_executor_shared_state(Executor& ex, BOOST_THREAD_FWD_REF(Fp) f) {
|
||||
shared_ptr<future_executor_shared_state<Rp> >
|
||||
h(new future_executor_shared_state<Rp>());
|
||||
h->init(ex, boost::forward<Fp>(f));
|
||||
shared_ptr<future_executor_shared_state<Rp, Executor> >
|
||||
h(new future_executor_shared_state<Rp, Executor>(ex));
|
||||
h->init(boost::forward<Fp>(f));
|
||||
return BOOST_THREAD_FUTURE<Rp>(h);
|
||||
}
|
||||
|
||||
@@ -4154,16 +4175,16 @@ namespace detail {
|
||||
|
||||
|
||||
template <typename T>
|
||||
BOOST_THREAD_FUTURE<T> make_exceptional_future(exception_ptr ex) {
|
||||
BOOST_THREAD_FUTURE<T> make_exceptional_future(exception_ptr excp) {
|
||||
promise<T> p;
|
||||
p.set_exception(ex);
|
||||
p.set_exception(excp);
|
||||
return BOOST_THREAD_MAKE_RV_REF(p.get_future());
|
||||
}
|
||||
|
||||
template <typename T, typename E>
|
||||
BOOST_THREAD_FUTURE<T> make_exceptional_future(E ex) {
|
||||
BOOST_THREAD_FUTURE<T> make_exceptional_future(E excp) {
|
||||
promise<T> p;
|
||||
p.set_exception(boost::copy_exception(ex));
|
||||
p.set_exception(boost::copy_exception(excp));
|
||||
return BOOST_THREAD_MAKE_RV_REF(p.get_future());
|
||||
}
|
||||
|
||||
@@ -4174,8 +4195,8 @@ namespace detail {
|
||||
return BOOST_THREAD_MAKE_RV_REF(p.get_future());
|
||||
}
|
||||
template <typename T>
|
||||
BOOST_THREAD_FUTURE<T> make_ready_future(exception_ptr ex) {
|
||||
return make_exceptional_future<T>(ex);
|
||||
BOOST_THREAD_FUTURE<T> make_ready_future(exception_ptr excp) {
|
||||
return make_exceptional_future<T>(excp);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -4233,7 +4254,17 @@ namespace detail
|
||||
|
||||
public:
|
||||
continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c)
|
||||
: parent(boost::move(f)),
|
||||
: ShSt(),
|
||||
parent(boost::move(f)),
|
||||
continuation(boost::move(c)),
|
||||
centinel(parent.future_)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Ex>
|
||||
continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c, Ex& ex)
|
||||
: ShSt(ex),
|
||||
parent(boost::move(f)),
|
||||
continuation(boost::move(c)),
|
||||
centinel(parent.future_)
|
||||
{
|
||||
@@ -4270,7 +4301,17 @@ namespace detail
|
||||
|
||||
public:
|
||||
continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c)
|
||||
: parent(boost::move(f)),
|
||||
: ShSt(),
|
||||
parent(boost::move(f)),
|
||||
continuation(boost::move(c)),
|
||||
centinel(parent.future_)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Ex>
|
||||
continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c, Ex& ex)
|
||||
: ShSt(ex),
|
||||
parent(boost::move(f)),
|
||||
continuation(boost::move(c)),
|
||||
centinel(parent.future_)
|
||||
{
|
||||
@@ -4372,27 +4413,25 @@ namespace detail
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename F, typename Rp, typename Fp>
|
||||
struct future_executor_continuation_shared_state: continuation_shared_state<F,Rp,Fp>
|
||||
template<typename F, typename Rp, typename Fp, typename Ex>
|
||||
struct future_executor_continuation_shared_state: continuation_shared_state<F,Rp,Fp,executor_shared_state<Rp, Ex> >
|
||||
{
|
||||
typedef continuation_shared_state<F,Rp,Fp> base_type;
|
||||
typedef continuation_shared_state<F,Rp,Fp,executor_shared_state<Rp, Ex> > base_type;
|
||||
|
||||
public:
|
||||
future_executor_continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c)
|
||||
: base_type(boost::move(f), boost::forward<Fp>(c))
|
||||
future_executor_continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c, Ex& ex)
|
||||
: base_type(boost::move(f), boost::forward<Fp>(c), ex)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Ex>
|
||||
void init(boost::unique_lock<boost::mutex> &lk, Ex& ex)
|
||||
void init(boost::unique_lock<boost::mutex> &lk)
|
||||
{
|
||||
this->set_executor_policy(executor_ptr_type(new executor_ref<Ex>(ex)), lk);
|
||||
this->base_type::init(lk);
|
||||
}
|
||||
|
||||
void launch_continuation() {
|
||||
run_it<base_type> fct(static_shared_from_this(this));
|
||||
this->get_executor()->submit(boost::move(fct));
|
||||
this->get_executor().submit(boost::move(fct));
|
||||
}
|
||||
|
||||
~future_executor_continuation_shared_state() {}
|
||||
@@ -4433,28 +4472,26 @@ namespace detail {
|
||||
/////////////////////////
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
|
||||
template<typename F, typename Rp, typename Fp>
|
||||
struct shared_future_executor_continuation_shared_state: continuation_shared_state<F,Rp,Fp>
|
||||
template<typename F, typename Rp, typename Fp, class Ex>
|
||||
struct shared_future_executor_continuation_shared_state: continuation_shared_state<F,Rp,Fp,executor_shared_state<Rp, Ex> >
|
||||
{
|
||||
typedef continuation_shared_state<F,Rp,Fp> base_type;
|
||||
typedef continuation_shared_state<F,Rp,Fp,executor_shared_state<Rp, Ex> > base_type;
|
||||
|
||||
public:
|
||||
|
||||
shared_future_executor_continuation_shared_state(F f, BOOST_THREAD_FWD_REF(Fp) c)
|
||||
: base_type(boost::move(f), boost::forward<Fp>(c))
|
||||
shared_future_executor_continuation_shared_state(F f, BOOST_THREAD_FWD_REF(Fp) c, Ex& ex)
|
||||
: base_type(boost::move(f), boost::forward<Fp>(c), ex)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Ex>
|
||||
void init(boost::unique_lock<boost::mutex> &lk, Ex& ex)
|
||||
void init(boost::unique_lock<boost::mutex> &lk)
|
||||
{
|
||||
this->set_executor_policy(executor_ptr_type(new executor_ref<Ex>(ex)), lk);
|
||||
this->base_type::init(lk);
|
||||
}
|
||||
|
||||
void launch_continuation() {
|
||||
run_it<base_type> fct(static_shared_from_this(this));
|
||||
this->get_executor()->submit(boost::move(fct));
|
||||
this->get_executor().submit(boost::move(fct));
|
||||
}
|
||||
|
||||
~shared_future_executor_continuation_shared_state() {}
|
||||
@@ -4645,9 +4682,9 @@ namespace detail {
|
||||
boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f,
|
||||
BOOST_THREAD_FWD_REF(Fp) c) {
|
||||
typedef typename decay<Fp>::type Cont;
|
||||
shared_ptr<future_executor_continuation_shared_state<F,Rp, Cont> >
|
||||
h(new future_executor_continuation_shared_state<F,Rp, Cont>(boost::move(f), boost::forward<Fp>(c)));
|
||||
h->init(lock, ex);
|
||||
shared_ptr<future_executor_continuation_shared_state<F,Rp, Cont, Ex> >
|
||||
h(new future_executor_continuation_shared_state<F,Rp, Cont, Ex>(boost::move(f), boost::forward<Fp>(c), ex));
|
||||
h->init(lock);
|
||||
|
||||
return BOOST_THREAD_FUTURE<Rp>(h);
|
||||
}
|
||||
@@ -4693,9 +4730,9 @@ namespace detail {
|
||||
boost::unique_lock<boost::mutex> &lock, F f,
|
||||
BOOST_THREAD_FWD_REF(Fp) c) {
|
||||
typedef typename decay<Fp>::type Cont;
|
||||
shared_ptr<shared_future_executor_continuation_shared_state<F, Rp, Cont> >
|
||||
h(new shared_future_executor_continuation_shared_state<F, Rp, Cont>(f, boost::forward<Fp>(c)));
|
||||
h->init(lock, ex);
|
||||
shared_ptr<shared_future_executor_continuation_shared_state<F, Rp, Cont, Ex> >
|
||||
h(new shared_future_executor_continuation_shared_state<F, Rp, Cont, Ex>(f, boost::forward<Fp>(c), ex));
|
||||
h->init(lock);
|
||||
|
||||
return BOOST_THREAD_FUTURE<Rp>(h);
|
||||
}
|
||||
@@ -4725,9 +4762,9 @@ namespace detail {
|
||||
)));
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
} else if (underlying_cast<int>(policy) & int(launch::executor)) {
|
||||
assert(this->future_->get_executor());
|
||||
assert(this->future_->get_executor_ptr(lock));
|
||||
typedef executor Ex;
|
||||
Ex& ex = *(this->future_->get_executor());
|
||||
Ex& ex = *(this->future_->get_executor_ptr(lock));
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_executor_continuation_shared_state<Ex, BOOST_THREAD_FUTURE<R>, future_type>(ex,
|
||||
lock, boost::move(*this), boost::forward<F>(func)
|
||||
)));
|
||||
@@ -4746,9 +4783,9 @@ namespace detail {
|
||||
)));
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
} else if (underlying_cast<int>(policy) & int(launch::executor)) {
|
||||
assert(this->future_->get_executor());
|
||||
assert(this->future_->get_executor_ptr(lock));
|
||||
typedef executor Ex;
|
||||
Ex& ex = *(this->future_->get_executor());
|
||||
Ex& ex = *(this->future_->get_executor_ptr(lock));
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_executor_continuation_shared_state<Ex, BOOST_THREAD_FUTURE<R>, future_type>(ex,
|
||||
lock, boost::move(*this), boost::forward<F>(func)
|
||||
)));
|
||||
@@ -4836,9 +4873,9 @@ namespace detail {
|
||||
)));
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
} else if (underlying_cast<int>(policy) & int(launch::executor)) {
|
||||
assert(this->future_->get_executor());
|
||||
assert(this->future_->get_executor_ptr(lock));
|
||||
typedef executor Ex;
|
||||
Ex& ex = *(this->future_->get_executor());
|
||||
Ex& ex = *(this->future_->get_executor_ptr(lock));
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_executor_continuation_shared_state<Ex, BOOST_THREAD_FUTURE<R>, future_type>(ex,
|
||||
lock, boost::move(*this), boost::forward<F>(func)
|
||||
)));
|
||||
@@ -4856,9 +4893,9 @@ namespace detail {
|
||||
)));
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
} else if (underlying_cast<int>(policy) & int(launch::executor)) {
|
||||
assert(this->future_->get_executor());
|
||||
assert(this->future_->get_executor_ptr(lock));
|
||||
typedef executor Ex;
|
||||
Ex& ex = *(this->future_->get_executor());
|
||||
Ex& ex = *(this->future_->get_executor_ptr(lock));
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_executor_continuation_shared_state<Ex, BOOST_THREAD_FUTURE<R>, future_type>(ex,
|
||||
lock, boost::move(*this), boost::forward<F>(func)
|
||||
)));
|
||||
@@ -4951,7 +4988,7 @@ namespace detail {
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
} else if (underlying_cast<int>(policy) & int(launch::executor)) {
|
||||
typedef executor Ex;
|
||||
Ex& ex = *(this->future_->get_executor());
|
||||
Ex& ex = *(this->future_->get_executor_ptr(lock));
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_shared_future_executor_continuation_shared_state<Ex, shared_future<R>, future_type>(ex,
|
||||
lock, *this, boost::forward<F>(func)
|
||||
)));
|
||||
@@ -4971,7 +5008,7 @@ namespace detail {
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
} else if (underlying_cast<int>(policy) & int(launch::executor)) {
|
||||
typedef executor Ex;
|
||||
Ex& ex = *(this->future_->get_executor());
|
||||
Ex& ex = *(this->future_->get_executor_ptr(lock));
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_shared_future_executor_continuation_shared_state<Ex, shared_future<R>, future_type>(ex,
|
||||
lock, *this, boost::forward<F>(func)
|
||||
)));
|
||||
|
||||
Reference in New Issue
Block a user