Depending on your framework - if you use a std::stream from which you get your sequence of bytes
which will be parsed in order to extract a message the simple example from boost.coroutine docu could help.
It demonstrates how a execution is suspended if the std::stream (stream_buf) can not provide enough bytes.