Boost logo

Boost Users :

From: Nikita Bige (big-nikita_at_[hidden])
Date: 2007-12-05 11:27:27


Hi,
Can you explain
Is it posibly to use timeouts if multiple threads are calling
io_service::run() on the single io_service object?

Thanks
On Tuesday 04 December 2007 12:19:36 Andrea Bartoli wrote:
> Use an asio::deadline_timer
>
> Example:
>
> asio::io_service m_ioService;
> asio::deadline_timer * m_timer;
> m_timer = new asio::deadline_timer(m_ioService);
>
> m_timer->expires_from_now( boost::posix_time::seconds(t) );
> m_timer->async_wait( boost::bind(&Foo:handle_timeout, this,
> asio::placeholders::error) ); asio::async_read( *m_socket,
> asio::buffer( m_msg.header(),
> m_msg.header_length() ), boost::bind(&Foo::handle_read_header, this,
> asio::placeholders::error) );
>
> This is a cut and paste from my code, if it isn't so clear I'll explain
> deeply. Tks

-- 
Wbr,
Nikita

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