mirror of
https://github.com/boostorg/thread.git
synced 2026-02-08 23:22:13 +00:00
Compare commits
5 Commits
feature/ad
...
boost-1.60
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83f877a238 | ||
|
|
47f615d073 | ||
|
|
7079a80edf | ||
|
|
dbf28a4ac4 | ||
|
|
2866734b15 |
@@ -1432,10 +1432,6 @@ namespace boost
|
||||
BOOST_THREAD_FUTURE<Rp>
|
||||
make_future_async_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
template <class F, class Rp, class Fp>
|
||||
BOOST_THREAD_FUTURE<Rp>
|
||||
make_future_sync_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
template <class F, class Rp, class Fp>
|
||||
BOOST_THREAD_FUTURE<Rp>
|
||||
make_future_deferred_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
@@ -1448,11 +1444,6 @@ namespace boost
|
||||
BOOST_THREAD_FUTURE<Rp>
|
||||
make_shared_future_async_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, F f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
template<typename F, typename Rp, typename Fp>
|
||||
BOOST_THREAD_FUTURE<Rp>
|
||||
make_shared_future_sync_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, F f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
template<typename Ex, typename F, typename Rp, typename Fp>
|
||||
BOOST_THREAD_FUTURE<Rp>
|
||||
@@ -1525,10 +1516,6 @@ namespace boost
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_future_async_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
template <class F, class Rp, class Fp>
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_future_sync_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
template <class F, class Rp, class Fp>
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_future_deferred_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
@@ -1541,10 +1528,6 @@ namespace boost
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_shared_future_async_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, F f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
template<typename F, typename Rp, typename Fp>
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_shared_future_sync_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, F f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
template<typename Ex, typename F, typename Rp, typename Fp>
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
@@ -1789,10 +1772,6 @@ namespace boost
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_future_async_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
template <class F, class Rp, class Fp>
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_future_sync_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
template <class F, class Rp, class Fp>
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_future_deferred_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
@@ -1805,10 +1784,6 @@ namespace boost
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_shared_future_async_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, F f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
template<typename F, typename Rp, typename Fp>
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_shared_future_sync_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, F f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
template<typename Ex, typename F, typename Rp, typename Fp>
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
@@ -2030,10 +2005,6 @@ namespace boost
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_future_async_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
template <class F, class Rp, class Fp>
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_future_sync_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
|
||||
template <class F, class Rp, class Fp>
|
||||
friend BOOST_THREAD_FUTURE<Rp>
|
||||
detail::make_future_deferred_continuation_shared_state(boost::unique_lock<boost::mutex> &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c);
|
||||
@@ -4239,6 +4210,12 @@ namespace detail {
|
||||
////////////////////////////////
|
||||
#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION
|
||||
|
||||
#if defined BOOST_THREAD_CONTINUATION_SYNC
|
||||
#define continuation_shared_state_base shared_state
|
||||
#else
|
||||
#define continuation_shared_state_base future_async_shared_state_base
|
||||
#endif
|
||||
|
||||
namespace detail
|
||||
{
|
||||
//////////////////////
|
||||
@@ -4368,43 +4345,26 @@ namespace detail
|
||||
/////////////////////////
|
||||
|
||||
template<typename F, typename Rp, typename Fp>
|
||||
struct future_async_continuation_shared_state: continuation_shared_state<F,Rp,Fp,future_async_shared_state_base<Rp> >
|
||||
struct future_async_continuation_shared_state: continuation_shared_state<F,Rp,Fp,continuation_shared_state_base<Rp> >
|
||||
{
|
||||
typedef continuation_shared_state<F,Rp,Fp,future_async_shared_state_base<Rp> > base_type;
|
||||
typedef continuation_shared_state<F,Rp,Fp,continuation_shared_state_base<Rp> > base_type;
|
||||
public:
|
||||
future_async_continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c)
|
||||
: base_type(boost::move(f), boost::forward<Fp>(c))
|
||||
{ }
|
||||
|
||||
void launch_continuation() {
|
||||
#if defined BOOST_THREAD_FUTURE_BLOCKING
|
||||
#if defined BOOST_THREAD_CONTINUATION_SYNC
|
||||
this->call();
|
||||
#elif defined BOOST_THREAD_FUTURE_BLOCKING
|
||||
boost::lock_guard<boost::mutex> lk(this->mutex);
|
||||
this->thr_ = thread(&future_async_continuation_shared_state::run, static_shared_from_this(this));
|
||||
#else
|
||||
thread(&base_type::run, static_shared_from_this(this)).detach();
|
||||
thread(&future_async_continuation_shared_state::run, static_shared_from_this(this)).detach();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/////////////////////////
|
||||
/// future_sync_continuation_shared_state
|
||||
/////////////////////////
|
||||
|
||||
template<typename F, typename Rp, typename Fp>
|
||||
struct future_sync_continuation_shared_state: continuation_shared_state<F,Rp,Fp,shared_state<Rp> >
|
||||
{
|
||||
typedef continuation_shared_state<F,Rp,Fp,shared_state<Rp> > base_type;
|
||||
public:
|
||||
future_sync_continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c)
|
||||
: base_type(boost::move(f), boost::forward<Fp>(c))
|
||||
{ }
|
||||
|
||||
void launch_continuation() {
|
||||
this->call();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////
|
||||
/// future_executor_continuation_shared_state
|
||||
/////////////////////////
|
||||
@@ -4485,9 +4445,9 @@ namespace detail {
|
||||
/////////////////////////
|
||||
|
||||
template<typename F, typename Rp, typename Fp>
|
||||
struct shared_future_async_continuation_shared_state: continuation_shared_state<F,Rp,Fp,future_async_shared_state_base<Rp> >
|
||||
struct shared_future_async_continuation_shared_state: continuation_shared_state<F,Rp,Fp,continuation_shared_state_base<Rp> >
|
||||
{
|
||||
typedef continuation_shared_state<F,Rp,Fp,future_async_shared_state_base<Rp> > base_type;
|
||||
typedef continuation_shared_state<F,Rp,Fp,continuation_shared_state_base<Rp> > base_type;
|
||||
|
||||
public:
|
||||
shared_future_async_continuation_shared_state(F f, BOOST_THREAD_FWD_REF(Fp) c)
|
||||
@@ -4496,36 +4456,19 @@ namespace detail {
|
||||
}
|
||||
|
||||
void launch_continuation() {
|
||||
#if defined BOOST_THREAD_FUTURE_BLOCKING
|
||||
#if defined BOOST_THREAD_CONTINUATION_SYNC
|
||||
this->call();
|
||||
#elif defined BOOST_THREAD_FUTURE_BLOCKING
|
||||
boost::lock_guard<boost::mutex> lk(this->mutex);
|
||||
this->thr_ = thread(&base_type::run, static_shared_from_this(this));
|
||||
this->thr_ = thread(&shared_future_async_continuation_shared_state::run, static_shared_from_this(this));
|
||||
#else
|
||||
thread(&base_type::run, static_shared_from_this(this)).detach();
|
||||
thread(&shared_future_async_continuation_shared_state::run, static_shared_from_this(this)).detach();
|
||||
#endif
|
||||
}
|
||||
|
||||
~shared_future_async_continuation_shared_state() {}
|
||||
};
|
||||
|
||||
/////////////////////////
|
||||
/// shared_future_async_continuation_shared_state
|
||||
/////////////////////////
|
||||
|
||||
template<typename F, typename Rp, typename Fp>
|
||||
struct shared_future_sync_continuation_shared_state: continuation_shared_state<F,Rp,Fp,shared_state<Rp> >
|
||||
{
|
||||
typedef continuation_shared_state<F,Rp,Fp,shared_state<Rp> > base_type;
|
||||
|
||||
public:
|
||||
shared_future_sync_continuation_shared_state(F f, BOOST_THREAD_FWD_REF(Fp) c)
|
||||
: base_type(boost::move(f), boost::forward<Fp>(c))
|
||||
{
|
||||
}
|
||||
|
||||
void launch_continuation() {
|
||||
this->call();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////
|
||||
/// shared_future_executor_continuation_shared_state
|
||||
/////////////////////////
|
||||
@@ -4634,21 +4577,6 @@ namespace detail {
|
||||
|
||||
return BOOST_THREAD_FUTURE<Rp>(h);
|
||||
}
|
||||
////////////////////////////////
|
||||
// make_future_sync_continuation_shared_state
|
||||
////////////////////////////////
|
||||
template<typename F, typename Rp, typename Fp>
|
||||
BOOST_THREAD_FUTURE<Rp>
|
||||
make_future_sync_continuation_shared_state(
|
||||
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_sync_continuation_shared_state<F,Rp, Cont> >
|
||||
h(new future_sync_continuation_shared_state<F,Rp, Cont>(boost::move(f), boost::forward<Fp>(c)));
|
||||
h->init(lock);
|
||||
|
||||
return BOOST_THREAD_FUTURE<Rp>(h);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
// make_future_executor_continuation_shared_state
|
||||
@@ -4700,21 +4628,6 @@ namespace detail {
|
||||
return BOOST_THREAD_FUTURE<Rp>(h);
|
||||
}
|
||||
////////////////////////////////
|
||||
// make_shared_future_sync_continuation_shared_state
|
||||
////////////////////////////////
|
||||
template<typename F, typename Rp, typename Fp>
|
||||
BOOST_THREAD_FUTURE<Rp>
|
||||
make_shared_future_sync_continuation_shared_state(
|
||||
boost::unique_lock<boost::mutex> &lock, F f,
|
||||
BOOST_THREAD_FWD_REF(Fp) c) {
|
||||
typedef typename decay<Fp>::type Cont;
|
||||
shared_ptr<shared_future_sync_continuation_shared_state<F,Rp, Cont> >
|
||||
h(new shared_future_sync_continuation_shared_state<F,Rp, Cont>(f, boost::forward<Fp>(c)));
|
||||
h->init(lock);
|
||||
|
||||
return BOOST_THREAD_FUTURE<Rp>(h);
|
||||
}
|
||||
////////////////////////////////
|
||||
// make_shared_future_executor_continuation_shared_state
|
||||
////////////////////////////////
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
@@ -4874,10 +4787,6 @@ namespace detail {
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_deferred_continuation_shared_state<BOOST_THREAD_FUTURE<R>, future_type>(
|
||||
lock, boost::move(*this), boost::forward<F>(func)
|
||||
)));
|
||||
} else if (underlying_cast<int>(policy) & int(launch::sync)) {
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_sync_continuation_shared_state<BOOST_THREAD_FUTURE<R>, future_type>(
|
||||
lock, boost::move(*this), boost::forward<F>(func)
|
||||
)));
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
} else if (underlying_cast<int>(policy) & int(launch::executor)) {
|
||||
assert(this->future_->get_executor());
|
||||
@@ -4898,10 +4807,6 @@ namespace detail {
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_deferred_continuation_shared_state<BOOST_THREAD_FUTURE<R>, future_type>(
|
||||
lock, boost::move(*this), boost::forward<F>(func)
|
||||
)));
|
||||
} else if (underlying_cast<int>(policy) & int(launch::sync)) {
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_sync_continuation_shared_state<BOOST_THREAD_FUTURE<R>, future_type>(
|
||||
lock, boost::move(*this), boost::forward<F>(func)
|
||||
)));
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
} else if (underlying_cast<int>(policy) & int(launch::executor)) {
|
||||
assert(this->future_->get_executor());
|
||||
@@ -4973,7 +4878,7 @@ namespace detail {
|
||||
lock, boost::move(*this), boost::forward<F>(func)
|
||||
)));
|
||||
} else {
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_sync_continuation_shared_state<BOOST_THREAD_FUTURE<R>, future_type>(
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_async_continuation_shared_state<BOOST_THREAD_FUTURE<R>, future_type>(
|
||||
lock, boost::move(*this), boost::forward<F>(func)
|
||||
)));
|
||||
}
|
||||
@@ -5001,10 +4906,6 @@ namespace detail {
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_shared_future_deferred_continuation_shared_state<shared_future<R>, future_type>(
|
||||
lock, *this, boost::forward<F>(func)
|
||||
)));
|
||||
} else if (underlying_cast<int>(policy) & int(launch::sync)) {
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_shared_future_sync_continuation_shared_state<shared_future<R>, future_type>(
|
||||
lock, *this, boost::forward<F>(func)
|
||||
)));
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
} else if (underlying_cast<int>(policy) & int(launch::executor)) {
|
||||
typedef executor Ex;
|
||||
@@ -5024,10 +4925,6 @@ namespace detail {
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_shared_future_deferred_continuation_shared_state<shared_future<R>, future_type>(
|
||||
lock, *this, boost::forward<F>(func)
|
||||
)));
|
||||
} else if (underlying_cast<int>(policy) & int(launch::sync)) {
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_shared_future_sync_continuation_shared_state<shared_future<R>, future_type>(
|
||||
lock, *this, boost::forward<F>(func)
|
||||
)));
|
||||
#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
|
||||
} else if (underlying_cast<int>(policy) & int(launch::executor)) {
|
||||
typedef executor Ex;
|
||||
@@ -5089,7 +4986,7 @@ namespace detail {
|
||||
lock, *this, boost::forward<F>(func)
|
||||
)));
|
||||
} else {
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_shared_future_sync_continuation_shared_state<shared_future<R>, future_type>(
|
||||
return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_shared_future_async_continuation_shared_state<shared_future<R>, future_type>(
|
||||
lock, *this, boost::forward<F>(func)
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ namespace boost
|
||||
executor = 4,
|
||||
#endif
|
||||
inherit = 8,
|
||||
sync = 16,
|
||||
any = async | deferred
|
||||
}
|
||||
BOOST_SCOPED_ENUM_DECLARE_END(launch)
|
||||
|
||||
Reference in New Issue
Block a user