Skip to content

Commit 15f19e6

Browse files
committed
macos errors.
1 parent 51a378e commit 15f19e6

4 files changed

Lines changed: 65 additions & 17 deletions

File tree

libs/core/algorithms/include/hpx/parallel/util/detail/sender_util.hpp

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#pragma once
99

10+
#include <hpx/errors/exception_list.hpp>
1011
#include <hpx/execution/algorithms/detail/partial_algorithm.hpp>
1112
#include <hpx/execution/algorithms/let_value.hpp>
1213
#include <hpx/execution/algorithms/then.hpp>
@@ -35,8 +36,23 @@ namespace hpx::detail {
3536
auto operator()(T1&& t1, Ts&&... ts) -> decltype(Tag{}(
3637
HPX_MOVE(policy), HPX_FORWARD(T1, t1), HPX_FORWARD(Ts, ts)...))
3738
{
38-
return Tag{}(
39-
HPX_MOVE(policy), HPX_FORWARD(T1, t1), HPX_FORWARD(Ts, ts)...);
39+
try
40+
{
41+
return Tag{}(
42+
HPX_MOVE(policy), HPX_FORWARD(T1, t1), HPX_FORWARD(Ts, ts)...);
43+
}
44+
catch (std::bad_alloc const&)
45+
{
46+
throw;
47+
}
48+
catch (hpx::exception_list const&)
49+
{
50+
throw;
51+
}
52+
catch (...)
53+
{
54+
throw hpx::exception_list(std::current_exception());
55+
}
4056
}
4157
};
4258

@@ -116,7 +132,7 @@ namespace hpx::detail {
116132
// 3. In the context of the experimental support for p2500
117133
// (wg21.link/p2500) this also adds two overloads that take either a
118134
// scheduler or a policy_aware_scheduler as its first argument (instead
119-
// of the usual execution policy). These overloads use an scheduler
135+
// of the usual execution policy). These overloads use a scheduler
120136
// based executor that is re-wrapped into an execution policy that is
121137
// then passed on to the underlying algorithm APIs.
122138
template <typename Tag>
@@ -125,7 +141,7 @@ namespace hpx::detail {
125141
{
126142
template <typename Sender, typename ExPolicy>
127143
// clang-format off
128-
requires (
144+
requires(
129145
hpx::is_execution_policy_v<ExPolicy> &&
130146
!detail::is_bound_algorithm_v<Sender> &&
131147
hpx::execution::experimental::is_sender_v<Sender>
@@ -185,9 +201,8 @@ namespace hpx::detail {
185201
hpx::execution::experimental::is_policy_aware_scheduler_v<
186202
std::decay_t<Scheduler>>,
187203
decltype(tag(
188-
scheduler.get_policy().on(std::declval<
189-
hpx::execution::experimental::
190-
explicit_scheduler_executor<
204+
scheduler.get_policy().on(std::declval<hpx::execution::
205+
experimental::explicit_scheduler_executor<
191206
std::decay_t<Scheduler>>>()),
192207
HPX_FORWARD(Ts, ts)...))>
193208
{

libs/core/execution/include/hpx/execution/algorithms/detail/partial_algorithm.hpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <hpx/concepts/concepts.hpp>
1111
#include <hpx/datastructures/member_pack.hpp>
12+
#include <hpx/errors/exception_list.hpp>
1213
#include <hpx/execution_base/completion_scheduler.hpp>
1314
#include <hpx/execution_base/completion_signatures.hpp>
1415
#include <hpx/execution_base/receiver.hpp>
@@ -34,8 +35,23 @@ namespace hpx::execution::experimental::detail {
3435
template <typename... Us>
3536
constexpr HPX_FORCEINLINE auto invoke(Us&&... us) &&
3637
{
37-
return Tag{}(
38-
HPX_FORWARD(Us, us)..., HPX_MOVE(ts).template get<Is>()...);
38+
try
39+
{
40+
return Tag{}(
41+
HPX_FORWARD(Us, us)..., HPX_MOVE(ts).template get<Is>()...);
42+
}
43+
catch (std::bad_alloc const&)
44+
{
45+
throw;
46+
}
47+
catch (hpx::exception_list const&)
48+
{
49+
throw;
50+
}
51+
catch (...)
52+
{
53+
throw hpx::exception_list(std::current_exception());
54+
}
3955
}
4056

4157
template <typename... Ts_>

libs/core/execution/include/hpx/execution/algorithms/sync_wait.hpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,36 @@ namespace hpx::execution::experimental::detail {
6262
{
6363
void operator()(std::exception_ptr ep) const
6464
{
65-
std::rethrow_exception(HPX_MOVE(ep));
65+
try
66+
{
67+
std::rethrow_exception(HPX_MOVE(ep));
68+
}
69+
catch (std::bad_alloc const&)
70+
{
71+
throw;
72+
}
73+
catch (hpx::exception_list const&)
74+
{
75+
throw;
76+
}
77+
catch (...)
78+
{
79+
throw hpx::exception_list(std::current_exception());
80+
}
6681
}
6782

6883
template <typename Error>
6984
void operator()(Error& error) const
7085
{
71-
throw error;
86+
if constexpr (std::is_same_v<Error, std::bad_alloc> ||
87+
std::is_same_v<Error, hpx::exception_list>)
88+
{
89+
throw error;
90+
}
91+
else
92+
{
93+
throw hpx::exception_list(std::make_exception_ptr(error));
94+
}
7295
}
7396
};
7497

libs/core/executors/include/hpx/executors/explicit_scheduler_executor.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,8 @@ namespace hpx::execution::experimental {
212212

213213
if constexpr (std::is_void_v<result_type>)
214214
{
215-
#if defined(HPX_HAVE_STDEXEC)
216-
return bulk(schedule(exec.sched_), shape,
217-
hpx::bind_back(HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...));
218-
#else
219-
// When stdexec is not available, use HPX's original bulk implementation
220215
return bulk(schedule(exec.sched_), shape,
221216
hpx::bind_back(HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...));
222-
#endif
223217
}
224218
else
225219
{

0 commit comments

Comments
 (0)