| 41 | } |
| 42 | |
| 43 | bool Stream::WaitForData() |
| 44 | { |
| 45 | if (!SupportsWaiting()) |
| 46 | BOOST_THROW_EXCEPTION(std::runtime_error("Stream does not support waiting.")); |
| 47 | |
| 48 | std::unique_lock<std::mutex> lock(m_Mutex); |
| 49 | |
| 50 | while (!IsDataAvailable() && !IsEof()) |
| 51 | m_CV.wait(lock); |
| 52 | |
| 53 | return IsDataAvailable() || IsEof(); |
| 54 | } |
| 55 | |
| 56 | bool Stream::WaitForData(int timeout) |
| 57 | { |