Boost logo

Boost Users :

Subject: [Boost-users] [asio] Throwing an exception on timeout
From: Pascal Kesseli (pascal_kesseli_at_[hidden])
Date: 2010-01-24 12:36:01


Hi folks

While reading out a serial interface with boost asio, I used the following timeout protection:

const boost::function<void(const error_code &)> SerialInterface::ON_TIMEOUT(if_then(_1 != error::operation_aborted, throw_exception(bind(constructor<
        SerialInterfaceTimeoutException> ()))));
// ...
void SerialInterface::read(void *buf, size_t size) throw(SerialInterfaceTimeoutException) {
    charTimeout.expires_from_now(maxCharDelay);
    charTimeout.async_wait(ON_TIMEOUT);
// ...

If a timeout occurs, the exception is thrown as expected. However, it is not handed any further from read, but instead the program terminates with a message concerning the exception. Is there any method having a throw() constraint in this async_wait chain?

Thanks for any hint and best regards
Pascal

                                               
_________________________________________________________________
Personalisiere dein Messenger, inklusive persönliche Smileys ;-) Überrasche deine Freunde - wir zeigen dir wie's geht.
http://rubrik.ch.msn.com/reportagen/personalisieren.aspx



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