|
Boost Users : |
Subject: Re: [Boost-users] asio: transporting exceptions across threads
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-07-21 16:38:53
I have never used boost::asio but a complete example of how to use
boost::exception_ptr can be found here (see Cloning and Re-Throwing an
Exception) :
http://www.boost.org/doc/libs/release/libs/exception/doc/tutorial_exception_ptr.html
Let me know if this works for you.
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
On Tue, Jul 21, 2009 at 11:00 AM, Zachary Turner<divisortheory_at_[hidden]> wrote:
> Suppose I have some io_service object in which I call run() from
> thread A. Thread A is the main controller of the i/o operations and
> does things like issuing reads and, upon completion, issuing writes
> for those reads. The writing service might wish to spawn off some
> child services that runs in thread B. So when thread A says
> writer.async_write_data() all it really does is call
> child_writer_service.post() with the data.
>
> Supposing an exception occurs in thread B, what is the best way to
> have this terminate the entire asio pipeline and propagate the
> exception all the way up to outside of thread A's call to
> io_service::run()?
>
> I've looked at the sample code on the boost::exception tutorial but
> I'm unable to apply this to the situation in asio, either due to
> differences in the threading model or due to my own misunderstandings.
>
> Thanks
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
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