
const boost::function
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?
Your ON_TIMEOUT() function is called from io_service::run(). io_service::run() does not handle your exceptions, so the exception is unhandled and the thread is aborted. By the way, use exception specifications carefully: http://www.gotw.ca/gotw/082.htm