Skip to content

Commit

Permalink
Moving hpx::threads::run_as_hpx_thread to namespace hpx
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Sep 14, 2023
1 parent c8ea2c7 commit a2307e5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
6 changes: 3 additions & 3 deletions examples/quickstart/init_globally.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,12 @@ void thread_func()

// Create an HPX thread (returning an int) and wait for it to run to
// completion.
int result = hpx::threads::run_as_hpx_thread(&hpx_thread_func2, 42);
int result = hpx::run_as_hpx_thread(&hpx_thread_func2, 42);

// Create an HPX thread (returning void) and wait for it to run to
// completion.
if (result == 42)
hpx::threads::run_as_hpx_thread(&hpx_thread_func1);
hpx::run_as_hpx_thread(&hpx_thread_func1);
}

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -286,7 +286,7 @@ int main()

// The main thread was automatically registered with the HPX runtime,
// no explicit registration for this thread is necessary.
hpx::threads::run_as_hpx_thread(&hpx_thread_func1);
hpx::run_as_hpx_thread(&hpx_thread_func1);

// wait for the (kernel) thread to run to completion
t.join();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
#include <type_traits>
#include <utility>

namespace hpx { namespace threads {
namespace hpx {

///////////////////////////////////////////////////////////////////////////
namespace detail {
// This is the overload for running functions which return a value.
Expand Down Expand Up @@ -148,4 +149,17 @@ namespace hpx { namespace threads {
return detail::run_as_hpx_thread(
result_is_void(), f, HPX_FORWARD(Ts, vs)...);
}
}} // namespace hpx::threads
} // namespace hpx

namespace hpx::threads {

template <typename F, typename... Ts>
HPX_DEPRECATED_V(1, 10,
"hpx::threads::run_as_hpx_thread is deprecated, use "
"hpx::run_as_hpx_thread instead")
decltype(auto) run_as_hpx_thread(F const& f, Ts&&... ts)
{
return hpx::run_as_hpx_thread(
HPX_FORWARD(F < f), HPX_FORWARD(Ts, ts)...);
}
} // namespace hpx::threads
2 changes: 1 addition & 1 deletion libs/full/collectives/src/barrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ namespace hpx { namespace distributed {
// make sure this runs as an HPX thread
if (hpx::threads::get_self_ptr() == nullptr)
{
hpx::threads::run_as_hpx_thread(&barrier::release, this);
hpx::run_as_hpx_thread(&barrier::release, this);
}

hpx::future<void> f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main(int argc, char** argv)
bool exception_caught = false;
try
{
hpx::threads::run_as_hpx_thread(&hpx_thread_func);
hpx::run_as_hpx_thread(&hpx_thread_func);
HPX_TEST(false); // this should not be executed
}
catch (...)
Expand Down

0 comments on commit a2307e5

Please sign in to comment.