Boost logo

Boost Users :

Subject: [Boost-users] Asio exception handling
From: Matthias Vallentin (vallentin_at_[hidden])
Date: 2010-02-11 20:29:55


Hi,

Consider the example where an io_service objects is used as scheduler,
with tasks handed to io_service::post(). According to the manual [1],
exceptions should propagate to the caller of io_service::run. However,
this does not seem to be the case with the attached example. Essentially,
I am doing the following:

    while (true)
    {
        try
        {
            io_service.post(task(&work));
            io_service.post(task(&work));
            io_service.post(task(&work));
            io_service.run();

            break;
        }
        catch (...)
        {
            // Never reached!
            std::cout << "catching exception" << std::endl;
        }
    }

I attached a minimal example that demonstrates this issue. Any help
would be appreciated.

   Matthias

[1] http://www.boost.org/doc/libs/1_42_0/doc/html/boost_asio/reference/io_service.html

-- 
Matthias Vallentin
vallentin_at_[hidden]
http://www.icir.org/matthias



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net