On Wed, Mar 4, 2009 at 12:09 PM, Stephan Menzel <stephan.menzel@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.