|
Boost Users : |
Subject: Re: [Boost-users] Asio timer - how to restart it?
From: Bill Somerville (bill_at_[hidden])
Date: 2008-10-23 11:20:48
Peleg wrote:
> Hello,
> I'm writing an Asio based serial port communication application.
> I've tried to use Asio timer as receive time out timer.
> The implementation consist of restarting the timer each time the receive
> event is called,
> , so it'll trigger only after time out duration with no receive event.
> The problem is that when I try to restart the timer, using
> expires_from_now(), the timer immediately
> triggers.
>
You are not getting asynchronous timeouts, all you are seeing is the
first timer being cancelled when you queue the second.
All asio async actions happen in the context of the io_service, you need
to call io_service.run() somewhere.
You have either oversimplified your example or you need to re-read the
asio examples.
HTH
Bill Somerville
...
> How do I restart to timer in the right way?
>
> Thanks,
> Peleg
>
>
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