Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] sync receive_from with timeout
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-03-04 09:30:29


Stephan,

what about that:

On Wed, Mar 4, 2009 at 3:20 PM, Stephan Menzel <stephan.menzel_at_gmx.eu>wrote:

> like this (pseudo):
>
> void readthread() {
> try

     {

> // go into blocking read
> sock.sync_receive_from(...);

        // signal successful read
     }
     catch(boost::thread_interrupted const& e)
     {
        //handle interruption
     }

>
> }
>
> original thread:
>
> ...
> thread t1(readthread);
> boost::this_thread::sleep(timeout);

     if(/*not signaled successful read*/)
       t1.interrupt();

Regards,
Ovanes



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