10
10
#define HPX_PARALLEL_UTIL_DETAIL_HANDLE_LOCAL_EXCEPTIONS_OCT_03_2014_0142PM
11
11
12
12
#include < hpx/config.hpp>
13
+ #include < hpx/assertion.hpp>
13
14
#include < hpx/async.hpp>
14
15
#include < hpx/errors.hpp>
15
16
#include < hpx/hpx_finalize.hpp>
@@ -30,6 +31,9 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
30
31
// std::bad_alloc has to be handled separately
31
32
HPX_NORETURN static void call (std::exception_ptr const & e)
32
33
{
34
+ #if defined(HPX_COMPUTE_DEVICE_CODE)
35
+ HPX_ASSERT (false );
36
+ #else
33
37
try
34
38
{
35
39
std::rethrow_exception (e);
@@ -42,11 +46,15 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
42
46
{
43
47
throw exception_list (e);
44
48
}
49
+ #endif
45
50
}
46
51
47
52
static void call (
48
53
std::exception_ptr const & e, std::list<std::exception_ptr>& errors)
49
54
{
55
+ #if defined(HPX_COMPUTE_DEVICE_CODE)
56
+ HPX_ASSERT (false );
57
+ #else
50
58
try
51
59
{
52
60
std::rethrow_exception (e);
@@ -59,12 +67,16 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
59
67
{
60
68
errors.push_back (e);
61
69
}
70
+ #endif
62
71
}
63
72
64
73
template <typename T>
65
74
static void call (std::vector<hpx::future<T>> const & workitems,
66
75
std::list<std::exception_ptr>& errors, bool throw_errors = true )
67
76
{
77
+ #if defined(HPX_COMPUTE_DEVICE_CODE)
78
+ HPX_ASSERT (false );
79
+ #else
68
80
for (hpx::future<T> const & f : workitems)
69
81
{
70
82
if (f.has_exception ())
@@ -73,13 +85,17 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
73
85
74
86
if (throw_errors && !errors.empty ())
75
87
throw exception_list (std::move (errors));
88
+ #endif
76
89
}
77
90
78
91
// /////////////////////////////////////////////////////////////////////
79
92
template <typename T>
80
93
static void call (std::vector<hpx::shared_future<T>> const & workitems,
81
94
std::list<std::exception_ptr>& errors, bool throw_errors = true )
82
95
{
96
+ #if defined(HPX_COMPUTE_DEVICE_CODE)
97
+ HPX_ASSERT (false );
98
+ #else
83
99
for (hpx::shared_future<T> const & f : workitems)
84
100
{
85
101
if (f.has_exception ())
@@ -88,13 +104,17 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
88
104
89
105
if (throw_errors && !errors.empty ())
90
106
throw exception_list (std::move (errors));
107
+ #endif
91
108
}
92
109
93
110
template <typename T, typename Cleanup>
94
111
static void call (std::vector<hpx::future<T>>& workitems,
95
112
std::list<std::exception_ptr>& errors, Cleanup&& cleanup,
96
113
bool throw_errors = true )
97
114
{
115
+ #if defined(HPX_COMPUTE_DEVICE_CODE)
116
+ HPX_ASSERT (false );
117
+ #else
98
118
bool has_exception = false ;
99
119
std::exception_ptr bad_alloc_exception;
100
120
for (hpx::future<T>& f : workitems)
@@ -135,6 +155,7 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
135
155
136
156
if (throw_errors && !errors.empty ())
137
157
throw exception_list (std::move (errors));
158
+ #endif
138
159
}
139
160
};
140
161
@@ -144,46 +165,66 @@ namespace hpx { namespace parallel { namespace util { namespace detail {
144
165
// /////////////////////////////////////////////////////////////////////
145
166
HPX_NORETURN static void call (std::exception_ptr const &)
146
167
{
168
+ #if defined(HPX_COMPUTE_DEVICE_CODE)
169
+ HPX_ASSERT (false );
170
+ #else
147
171
hpx::terminate ();
172
+ #endif
148
173
}
149
174
150
175
HPX_NORETURN static void call (
151
176
std::exception_ptr const &, std::list<std::exception_ptr>&)
152
177
{
178
+ #if defined(HPX_COMPUTE_DEVICE_CODE)
179
+ HPX_ASSERT (false );
180
+ #else
153
181
hpx::terminate ();
182
+ #endif
154
183
}
155
184
156
185
template <typename T>
157
186
static void call (std::vector<hpx::future<T>> const & workitems,
158
187
std::list<std::exception_ptr>&, bool = true )
159
188
{
189
+ #if defined(HPX_COMPUTE_DEVICE_CODE)
190
+ HPX_ASSERT (false );
191
+ #else
160
192
for (hpx::future<T> const & f : workitems)
161
193
{
162
194
if (f.has_exception ())
163
195
hpx::terminate ();
164
196
}
197
+ #endif
165
198
}
166
199
167
200
template <typename T>
168
201
static void call (std::vector<hpx::shared_future<T>> const & workitems,
169
202
std::list<std::exception_ptr>&, bool = true )
170
203
{
204
+ #if defined(HPX_COMPUTE_DEVICE_CODE)
205
+ HPX_ASSERT (false );
206
+ #else
171
207
for (hpx::shared_future<T> const & f : workitems)
172
208
{
173
209
if (f.has_exception ())
174
210
hpx::terminate ();
175
211
}
212
+ #endif
176
213
}
177
214
178
215
template <typename T, typename Cleanup>
179
216
static void call (std::vector<hpx::future<T>> const & workitems,
180
217
std::list<std::exception_ptr>&, Cleanup&&, bool = true )
181
218
{
219
+ #if defined(HPX_COMPUTE_DEVICE_CODE)
220
+ HPX_ASSERT (false );
221
+ #else
182
222
for (hpx::future<T> const & f : workitems)
183
223
{
184
224
if (f.has_exception ())
185
225
hpx::terminate ();
186
226
}
227
+ #endif
187
228
}
188
229
};
189
230
}}}} // namespace hpx::parallel::util::detail
0 commit comments