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 06:40:54


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

> Hi Ovanes,
>
> > Well, my suggestion was the following:
> > If the socket is blocked in a thread, the thread is blocked as well (and
> > luckily boost::thread recognizes it as an iterruption point). Issue
> > interrupt to that thread and the socket's wait will be interrupted. I
> > don't
> > remember If the socket is consistent after this operation, but I know it
> > worked and I was able to close it as if nothing happened.
> >
> > Hope that clarifies the issue,
>
> Ah, right. Yes it does. That seems rather tricky to implement.
> I just had a little try on it and I noticed that in order to interrupt the
> thread calling the blocking wait one would need this thread's boost::thread
> object. Which cannot be obtained from the this_thread::id. So each thread
> calling that interruptable receive would have to have it's boost::thread
> object to pass it to the function, right?
> I can't see how I could expose all this to the interface of this method. I
> think it has to be closer to asio.
>
> Cheers,
>
> Stephan
>

 Yes, you probably need to pass a thread reference to be interrupted after
some timeout, otherwise that would not work.

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