#include #include using Context = boost::context::execution_context; Context Main(Context context) { try { throw std::runtime_error("123"); } catch (const std::exception& ex) { context = context(); } return context(); } int main() { Context context(&Main); context = context(); std::thread([&] { context = context(); }).join(); return 0; }