You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case an exception is thrown inside a task, this exception leads to the direct termination of the application.
To fix that, the scheduler has to catch the exception in the sub-task and set the exception-context of the promise object itself.
For details, see cppreference: https://en.cppreference.com/w/cpp/thread/promise/set_exception
Example:
auto fut = pool.submit([](){throwstd::runtime_error("error");});
try {
fut.get();
} catch(std::runtime_error & e){
std::cout << "catched error" << std::endl;
}
This application terminates with:
terminate called after throwing an instance of 'std::runtime_error'
The text was updated successfully, but these errors were encountered:
In case an exception is thrown inside a task, this exception leads to the direct termination of the application.
To fix that, the scheduler has to catch the exception in the sub-task and set the exception-context of the promise object itself.
For details, see cppreference: https://en.cppreference.com/w/cpp/thread/promise/set_exception
Example:
This application terminates with:
The text was updated successfully, but these errors were encountered: