
Hi Ovanes,
So each thread calling that interruptable receive would have to have it's boost::thread object to pass it to the function, right? ... Yes, you probably need to pass a thread reference to be interrupted after some timeout, otherwise that would not work.
Well, I just tried to work around that with io_services running thread pools and all but there's little hope as all things I could come up with that realize this would require the thread object. The only thing I could imagine would be an extra thread which could be created to execute the blocking IO starts, while the original thread goes into a sleep that can be interrupted by the new thread upon successfuly return of the blocking read. like this (pseudo): void readthread() { // go into blocking read sock.sync_receive_from(...); } original thread: ... thread t1(readthread); try { boost::this_thread::sleep(timeout) } catch (const boost::thread_interrupted &e) { } ..but that would of course mean a new thread each time and I don't think it'll work. Looks like I'm gonna have to find another way. Cheers... Stephan