Skip to content

Commit

Permalink
Renaming launch::lazy --> launch::select
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Aug 10, 2017
1 parent 69fef1f commit 338459f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
23 changes: 11 additions & 12 deletions hpx/runtime/launch_policy.hpp
Expand Up @@ -196,15 +196,15 @@ namespace hpx
};

template <typename Pred>
struct lazy_policy : policy_holder<lazy_policy<Pred> >
struct select_policy : policy_holder<select_policy<Pred> >
{
template <typename F, typename U =
typename std::enable_if<!std::is_same<
lazy_policy<Pred>, typename std::decay<F>::type
select_policy<Pred>, typename std::decay<F>::type
>::value>::type>
explicit lazy_policy(F && f, threads::thread_priority priority =
explicit select_policy(F && f, threads::thread_priority priority =
threads::thread_priority_default)
: policy_holder<lazy_policy<Pred> >(launch_policy::async, priority)
: policy_holder<select_policy<Pred> >(launch_policy::async, priority)
, pred_(std::forward<F>(f))
{}

Expand All @@ -222,7 +222,7 @@ namespace hpx
Pred pred_;
};

struct lazy_policy_generator
struct select_policy_generator
{
HPX_CONSTEXPR async_policy operator()(
threads::thread_priority priority) const noexcept
Expand All @@ -231,11 +231,11 @@ namespace hpx
}

template <typename F>
lazy_policy<typename std::decay<F>::type> operator()(F && f,
select_policy<typename std::decay<F>::type> operator()(F && f,
threads::thread_priority priority =
threads::thread_priority_default) const
{
return lazy_policy<typename std::decay<F>::type>(
return select_policy<typename std::decay<F>::type>(
std::forward<F>(f), priority);
}
};
Expand Down Expand Up @@ -377,7 +377,7 @@ namespace hpx

/// Create a launch policy representing fire and forget execution
template <typename F>
HPX_CONSTEXPR launch(detail::lazy_policy<F> const& p) noexcept
HPX_CONSTEXPR launch(detail::select_policy<F> const& p) noexcept
: detail::policy_holder<>{p.policy()}
{}

Expand All @@ -389,7 +389,7 @@ namespace hpx
using deferred_policy = detail::deferred_policy;
using apply_policy = detail::apply_policy;
template <typename F>
using lazy_policy = detail::lazy_policy<F>;
using select_policy = detail::select_policy<F>;
/// \endcond

///////////////////////////////////////////////////////////////////////
Expand All @@ -409,9 +409,8 @@ namespace hpx
/// Predefined launch policy representing fire and forget execution
HPX_EXPORT static const detail::apply_policy apply;

/// Predefined launch policy representing conditionally asynchronous
/// execution
HPX_EXPORT static const detail::lazy_policy_generator lazy;
/// Predefined launch policy representing delayed policy selection
HPX_EXPORT static const detail::select_policy_generator select;

/// \cond NOINTERNAL
HPX_EXPORT static const detail::policy_holder<> all;
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/launch_policy.cpp
Expand Up @@ -20,8 +20,8 @@ namespace hpx
const detail::deferred_policy launch::deferred = detail::deferred_policy{};
const detail::apply_policy launch::apply = detail::apply_policy{};

const detail::lazy_policy_generator launch::lazy =
detail::lazy_policy_generator{};
const detail::select_policy_generator launch::select =
detail::select_policy_generator{};

const detail::policy_holder<> launch::all =
detail::policy_holder<>{detail::launch_policy::all};
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/lcos/async_local.cpp
Expand Up @@ -260,7 +260,7 @@ int hpx_main()
using hpx::util::placeholders::_1;

auto policy1 =
hpx::launch::lazy([]()
hpx::launch::select([]()
{
return hpx::launch::sync;
});
Expand All @@ -275,7 +275,7 @@ int hpx_main()

boost::atomic<int> count(0);
auto policy2 =
hpx::launch::lazy([&count]() -> hpx::launch
hpx::launch::select([&count]() -> hpx::launch
{
if (count++ == 0)
return hpx::launch::async;
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/lcos/async_remote.cpp
Expand Up @@ -159,7 +159,7 @@ void test_remote_async(hpx::id_type const& target)

{
auto policy1 =
hpx::launch::lazy([]()
hpx::launch::select([]()
{
return hpx::launch::deferred;
});
Expand All @@ -170,7 +170,7 @@ void test_remote_async(hpx::id_type const& target)

boost::atomic<int> count(0);
auto policy2 =
hpx::launch::lazy([&count]() -> hpx::launch
hpx::launch::select([&count]() -> hpx::launch
{
if (count++ == 0)
return hpx::launch::async;
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/lcos/future_then.cpp
Expand Up @@ -161,7 +161,7 @@ void test_complex_then()
void test_complex_then_launch()
{
auto policy =
hpx::launch::lazy([]()
hpx::launch::select([]()
{
return hpx::launch::async;
});
Expand All @@ -184,7 +184,7 @@ void test_complex_then_chain_one_launch()
{
boost::atomic<int> count(0);
auto policy =
hpx::launch::lazy(
hpx::launch::select(
[&count]() -> hpx::launch
{
if (count++ == 0)
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/lcos/local_dataflow.cpp
Expand Up @@ -327,7 +327,7 @@ void plain_arguments_lazy()
int_f4_count.store(0);

auto policy1 =
hpx::launch::lazy([]()
hpx::launch::select([]()
{
return hpx::launch::sync;
});
Expand All @@ -344,7 +344,7 @@ void plain_arguments_lazy()
}

auto policy2 =
hpx::launch::lazy([]()
hpx::launch::select([]()
{
return hpx::launch::async;
});
Expand All @@ -365,7 +365,7 @@ void plain_arguments_lazy()

boost::atomic<int> count(0);
auto policy3 =
hpx::launch::lazy([&count]() -> hpx::launch
hpx::launch::select([&count]() -> hpx::launch
{
if (count++ == 0)
return hpx::launch::async;
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/lcos/remote_dataflow.cpp
Expand Up @@ -85,7 +85,7 @@ void plain_actions(hpx::id_type const& there)
}

auto policy1 =
hpx::launch::lazy([]()
hpx::launch::select([]()
{
return hpx::launch::sync;
});
Expand All @@ -106,7 +106,7 @@ void plain_actions(hpx::id_type const& there)

boost::atomic<int> count(0);
auto policy2 =
hpx::launch::lazy([&count]() -> hpx::launch
hpx::launch::select([&count]() -> hpx::launch
{
if (count++ == 0)
return hpx::launch::async;
Expand Down

0 comments on commit 338459f

Please sign in to comment.