Hi all,
currently i try to understand boost asio a little better. Right now, i
just had a very simple asio program and started 2 timers asyncronously.
i expected the timer t to complete after the timer i.
//-------<-----------------
Current output:
10 s.
1 s.
//-------<-----------------
Expected output:
1 s.
10 s.
//-------<-----------------
Shouldn't complete the async_wait with 1 sec complete prior the 10 sec
async_wait?
I am on Windows 7 x64/ MSVC 2013(VS12) / Boost 1.57.0.
Regards
Georg
//-------<-----------------
#include
Am 31.03.2015 um 14:55 schrieb georg@schorsch-tech.de:
Hi all, currently i try to understand boost asio a little better. Right now, i just had a very simple asio program and started 2 timers asyncronously.
i expected the timer t to complete after the timer i.
//-------<----------------- Current output: 10 s. 1 s. //-------<----------------- Expected output: 1 s. 10 s. //-------<-----------------
Shouldn't complete the async_wait with 1 sec complete prior the 10 sec async_wait?
I am on Windows 7 x64/ MSVC 2013(VS12) / Boost 1.57.0.
Regards Georg
//-------<----------------- #include
#include #include <iostream> void wait_handler(const boost::system::error_code &ec) { if (!ec) std::cout << "10 s." << std::endl; }
void irq_handler(const boost::system::error_code &ec) { if (!ec) std::cout << "1 s." << std::endl; }
int main() { boost::asio::io_service io_service; boost::asio::deadline_timer t(io_service, boost::posix_time::seconds(10)); boost::asio::deadline_timer i(io_service, boost::posix_time::seconds(1));
t.async_wait(&wait_handler); t.async_wait(&irq_handler);
This is using 't' twice. Is this what you wanted ?
io_service.run(); }
Stefan -- ---------------------------------------------------------------- /dev/random says: Error reading FAT record: Try the SKINNY one? (Y/N) python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')" GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9 9666 829B 49C5 9221 27AF
participants (3)
-
Georg Gast
-
georg@schorsch-tech.de
-
Stefan Näwe