
19 Sep
2009
19 Sep
'09
11:04 p.m.
On Thu, 17 Sep 2009 09:11 +0200, "Roland Schwarz" <roland.schwarz@chello.at> wrote:
Is it legal to mix async and sync function calls? (I was not able to find the answer in the doc.)
E.g.
socket.async_read_some(buf); socket.write_some(otherbuf);
Yes. Some examples use this (e.g. porthopper). Do make sure you respect the documented thread safety requirements though (i.e. don't do the above function calls concurrently).
Also when in a blocking sync call, will it be possible to "cancel" it from another thread, e.g. by posting to the io_service which will invoke a close on the socket?
No. Only async calls can be portably cancelled. Cheers, Chris