开发者

Is it safe to manipulated streambuf after doing boost::asio::async_read?

I know it's not safe to manipulated streambuf while async_write working as stated by asio author on boost mailing list. What I want to know开发者_开发问答 is, is it safe to manipulated streambuf after async_read?

Example:

async_read(socket_, recv_streambuf_, ...);
// manipulated while async_read is working
// for example, after I call async_read,
recv_streambuf_.consume(2); 
// or something advance, like this...
int var;
std::istream recv_is(recv_streambuf_);
recv_is >> var; 


You should be able to do whatever you like with the streambuf when your async_read callback is executed. The callback lets us know when asio is finished using the memory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜