$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [asio] reopening of serial port fails - why?
From: Bill Somerville (bill_at_[hidden])
Date: 2009-03-06 04:51:44
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