Unblock synchronous read on boost::asio::serial_port
问题 I have a boost::thread which performs synchronous reads on a boost::asio::serial_port . When I destroy an instance of the class which contains both, I want the thread to end gracefully even if its blocked in a read call. How can I do this? Looking at the docs, I tried cancel , but it works only for asynchronous reads/writes. Then I tried close , but I got an exception and it wasn't the kind you can recover from. Perhaps using send_break or native_handle ? (this is Windows and portability's