Skip to content

Commit 2090b4a

Browse files
committed
Don't crash on pthread_cancel
Justinas V. Daugmaudis: This patch prevents abi::__forced_unwind from being eaten
1 parent aefcb87 commit 2090b4a

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

include/boost/coroutine/detail/pull_coroutine_object.hpp

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

1010
#include <boost/assert.hpp>
1111
#include <boost/config.hpp>
12+
#include <boost/context/detail/config.hpp>
1213
#include <boost/cstdint.hpp>
1314
#include <boost/exception_ptr.hpp>
1415
#include <boost/move/move.hpp>
@@ -115,6 +116,10 @@ class pull_coroutine_object : private pull_coroutine_context,
115116
{ fn_( push_coro); }
116117
catch ( forced_unwind const&)
117118
{}
119+
#if defined( BOOST_CONTEXT_HAS_CXXABI_H )
120+
catch ( abi::__forced_unwind const&)
121+
{ throw; }
122+
#endif
118123
catch (...)
119124
{ base_t::except_ = current_exception(); }
120125

@@ -198,6 +203,10 @@ class pull_coroutine_object< PushCoro, R &, Fn, StackAllocator > : private pull_
198203
{ fn_( push_coro); }
199204
catch ( forced_unwind const&)
200205
{}
206+
#if defined( BOOST_CONTEXT_HAS_CXXABI_H )
207+
catch ( abi::__forced_unwind const&)
208+
{ throw; }
209+
#endif
201210
catch (...)
202211
{ base_t::except_ = current_exception(); }
203212

@@ -281,6 +290,10 @@ class pull_coroutine_object< PushCoro, void, Fn, StackAllocator > : private pull
281290
{ fn_( push_coro); }
282291
catch ( forced_unwind const&)
283292
{}
293+
#if defined( BOOST_CONTEXT_HAS_CXXABI_H )
294+
catch ( abi::__forced_unwind const&)
295+
{ throw; }
296+
#endif
284297
catch (...)
285298
{ base_t::except_ = current_exception(); }
286299

include/boost/coroutine/detail/push_coroutine_object.hpp

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

1010
#include <boost/assert.hpp>
1111
#include <boost/config.hpp>
12+
#include <boost/context/detail/config.hpp>
1213
#include <boost/cstdint.hpp>
1314
#include <boost/exception_ptr.hpp>
1415
#include <boost/move/move.hpp>
@@ -127,6 +128,10 @@ class push_coroutine_object : private push_coroutine_context,
127128
{ fn_( pull_coro); }
128129
catch ( forced_unwind const&)
129130
{}
131+
#if defined( BOOST_CONTEXT_HAS_CXXABI_H )
132+
catch ( abi::__forced_unwind const&)
133+
{ throw; }
134+
#endif
130135
catch (...)
131136
{ base_t::except_ = current_exception(); }
132137

@@ -210,6 +215,10 @@ class push_coroutine_object< PullCoro, R &, Fn, StackAllocator > : private push_
210215
{ fn_( push_coro); }
211216
catch ( forced_unwind const&)
212217
{}
218+
#if defined( BOOST_CONTEXT_HAS_CXXABI_H )
219+
catch ( abi::__forced_unwind const&)
220+
{ throw; }
221+
#endif
213222
catch (...)
214223
{ base_t::except_ = current_exception(); }
215224

@@ -293,6 +302,10 @@ class push_coroutine_object< PullCoro, void, Fn, StackAllocator > : private push
293302
{ fn_( push_coro); }
294303
catch ( forced_unwind const&)
295304
{}
305+
#if defined( BOOST_CONTEXT_HAS_CXXABI_H )
306+
catch ( abi::__forced_unwind const&)
307+
{ throw; }
308+
#endif
296309
catch (...)
297310
{ base_t::except_ = current_exception(); }
298311

0 commit comments

Comments
 (0)