Skip to content

Commit bbe251a

Browse files
author
Conor
committed
except handling basics
1 parent f946380 commit bbe251a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/core/promise.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ struct awaitable : std::suspend_always {
233233
template <worker_context Context>
234234
struct join_awaitable {
235235

236+
using except_type = frame_type<Context>::except_type;
237+
236238
frame_type<Context> *frame;
237239

238240
constexpr auto take_stack_and_reset(this join_awaitable self) noexcept -> void {
@@ -310,15 +312,18 @@ struct join_awaitable {
310312
return std::noop_coroutine();
311313
}
312314

315+
[[noreturn]]
316+
constexpr auto rethrow_exception(this join_awaitable self) -> void {}
317+
313318
constexpr void await_resume(this join_awaitable self) {
314319
// We should have been reset
315320
LF_ASSUME(self.frame->steals == 0);
316321
LF_ASSUME(self.frame->joins == k_u16_max);
317322

323+
// Outside parallel regions so can touch non-atomically.
318324
if constexpr (LF_COMPILER_EXCEPTIONS) {
319-
if (self.frame->exception_bit) {
320-
// TODO: rest exception but as part of handling
321-
LF_THROW(std::runtime_error{"Child task threw an exception"});
325+
if (self.frame->exception_bit) [[unlikely]] {
326+
self.rethrow_exception();
322327
}
323328
}
324329
}

0 commit comments

Comments
 (0)