|
Boost Users : |
Subject: Re: [Boost-users] [asio] sync receive_from with timeout
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-03-04 05:35:49
Well, an interesting approach. Alas, I'd rather not stray so far into the
> realm of workarounds but try to solve the issue in a more standard and
> mean-to-be way. Also it has to work on windows and several unix flavours. My
> favorite solution would be the boost community would consider to include
> timouts in sync IO hence making it useful and adding value to asio.
>
> I'm not sure whether I understand correctly what you suggest but wouldn't
> that affect the socket itself rather than the code using it?
> In my case the socket is a static object and protected via mutex so there's
> no thread ownership in general sense.
>
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,
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