File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -166,11 +166,10 @@ template <category Cat, worker_context Context>
166166struct awaitable : std::suspend_always {
167167
168168 using enum category;
169+ using except_type = frame_type<Context>::except_type;
169170
170171 frame_type<Context> *child;
171172
172- // TODO: optional cancellation token
173-
174173 template <typename T>
175174 LF_NO_INLINE constexpr void
176175 stash_exception (this awaitable self, coro<promise_type<T, Context>> parent) noexcept {
@@ -179,10 +178,16 @@ struct awaitable : std::suspend_always {
179178
180179 frame_type<Context> &frame = parent.promise ().frame ;
181180
182- // No synchronisation is done via exception_bit, hence we can use relaxed atomics and
183- // rely on the usual fork/join synchronisation to ensure memory ordering.
181+ // No synchronisation is done via exception_bit, hence we can use relaxed atomics
182+ // and rely on the usual fork/join synchronisation to ensure memory ordering.
184183 if (frame.atomic_except ().exchange (1 , std::memory_order_relaxed) == 0 ) {
184+ frame.except = new except_type{
185+ .stashed = frame.parent ,
186+ .exception = std::current_exception (),
187+ };
185188 }
189+
190+ // Else, the exception is dropped.
186191 }
187192
188193 template <typename T>
You can’t perform that action at this time.
0 commit comments