Processing exceptions is not always trivial and may take a lot of time. Consider the situation where an exception must be serialized and sent by the network. This may take milliseconds and a few thousand lines of code. After the exception is caught is not always the best time and place to process it.
So, can we store exceptions and delay their processing?
This recipe requires knowledge of
boost::asio::io_service, which was described in the first recipe of this chapter. Knowledge of
Boost.Bind is also required.
All we need is to have the ability to store exceptions and pass them between threads just like a normal variable.