O'Reilly logo

Boost C++ Application Development Cookbook by Antony Polukhin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Storing an exception and making a task from it

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?

Getting ready

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.

How to do it...

All we need is to have the ability to store exceptions and pass them between threads just like a normal variable.

  1. Let's start with the function that processes exceptions. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required