
Markus Werle wrote:
Hi!
The code below perfectly reads characters from the serial line for 6 seconds. The termination of the thread and a reopening of the connection then fails.
What am i missing here?
Markus
... snip ...
boost::asio::io_service io_service; // define an instance of the main class of this program minicom_client c(io_service, boost::lexical_cast<unsigned int> (argv[1]), argv[2]); // run the IO service as a separate thread, so the main thread can block on standard input
while (true) // PROBLEM: reentering this loop fails - why? {
You need to call reset() on the io_service instance before you can call run() for a second time.
boost::thread t(boost::bind (&boost::asio::io_service::run, &io_service));
... snip ... HTH Bill Somerville