Nothing magical happens. If you catch an exception somewhere, your catch handle it. Otherwise, an uncaught exception terminates the process.
How you should deal with this depends on what you want. If an exception should never happen, then let it stop the process. If you want to eat or handle exceptions, then write a function that wraps io_service::run in a try / catch and starts threads instead.
I do not like to put intelligence away from code. My preferred solution is that my asynchronous functions do not throw exceptions unless there is a really fatal error. If an asynchronous function knows how to handle an exception that it can throw, then it should catch it.
However, it is perfectly acceptable to wrap run if that makes sense in your application.
source share