Boost logo

Boost Users :

Subject: [Boost-users] How to use boost::asio to implement a synchronous operation with timeouts?
From: watsonsong (911songfeiyu_at_[hidden])
Date: 2009-12-22 03:15:11


    I'm trying to develop some function that will block until the protocol
exchange finished or some error occur, or timeout.
    In the boost official documents, the example of timeouts in asio is
implements by asynchronous operations and a deadline_timer. But what I want
is a synchronous operation with a timeout, but I search nearly all of the
reference manual and find nothing about it.
    In an other words, how can I used the asynchronous operations to
simulate synchronous operations with timeouts.
    Maybe I could launch an asynchronous operation and call
io_service::run_one immediately, but I don't know whether it is safe when I
call io_service::run_one in a complete callback function which is call by
io_service::run?
    Or there is any classic solution of this question.
    Thank you.

-- 
View this message in context: http://old.nabble.com/How-to-use-boost%3A%3Aasio-to-implement-a-synchronous-operation-with-timeouts--tp26882833p26882833.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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