Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] reopening of serial port fails - why?
From: Bill Somerville (bill_at_[hidden])
Date: 2009-03-06 05:22:21


Markus Werle wrote:
> Bill Somerville <bill <at> classdesign.com> writes:
>
>
>> You need to call reset() on the io_service instance before you can call
>> run() for a second time.
>>
>
>
> I tried this:
>
> while (true) // PROBLEM: reentering this loop fails - why?
> {
> io_service.reset();
> boost::thread t(boost::bind(&boost::asio::io_service::run, &io_service));
> [...]
>
>
> Now the reconnection does not succeed either and
> after some tries I obtain an invalid file handle error.
>

You didn't say how the first version or this version fails, an error
message or some unexpected behaviour would help.

> I guess I am missing some fundamental thing with asio ...
>
> Markus
>
>

--
Bill Somerville

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