| 516 | } |
| 517 | |
| 518 | void TFileTransport::flush() { |
| 519 | resetConsumedMessageSize(); |
| 520 | // file must be open for writing for any flushing to take place |
| 521 | if (!writerThread_.get()) { |
| 522 | return; |
| 523 | } |
| 524 | // wait for flush to take place |
| 525 | Guard g(mutex_); |
| 526 | |
| 527 | // Indicate that we are requesting a flush |
| 528 | forceFlush_ = true; |
| 529 | // Wake up the writer thread so it will perform the flush immediately |
| 530 | notEmpty_.notify(); |
| 531 | |
| 532 | while (forceFlush_) { |
| 533 | flushed_.wait(); |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | uint32_t TFileTransport::readAll(uint8_t* buf, uint32_t len) { |
| 538 | checkReadBytesAvailable(len); |