Boost logo

Boost Users :

Subject: Re: [Boost-users] boost asio: Probelm with closing a blocking ip::udp::socket receive
From: Igor R (boost.lists_at_[hidden])
Date: 2009-03-12 11:14:16


> OK, thanks, but how am I supposed to close a thread which has a blocking receive in it?

Probably, in the current impelmentation of ASIO you can use the
technique described in the following discussion:
http://www.nabble.com/-asio--sync-receive_from-with-timeout-tt22326399.html#a22326851

But in general, how would you "close" blocking recv() (for example, in
Winsock)? You can terminate its thread, but then you can't be sure
that the socket is in a valid state.
Usually, if you're going to make non-trivial i/o with asio (involving
timeouts etc.), then asynchronous i/o is the way to go.


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