| 804 | |
| 805 | |
| 806 | void CopcReader::load(const copc::Entry& entry) |
| 807 | { |
| 808 | m_p->pool->add([this, entry]() |
| 809 | { |
| 810 | // Read the tile. |
| 811 | copc::Tile tile(entry, *m_p->connector, m_p->header); |
| 812 | tile.read(); |
| 813 | |
| 814 | // Put the tile on the output queue. |
| 815 | std::unique_lock<std::mutex> l(m_p->mutex); |
| 816 | m_p->consumedCv.wait(l, [this] { |
| 817 | return (m_p->done || |
| 818 | m_p->contents.size() < (size_t)m_args->keepAliveChunkCount);}); |
| 819 | m_p->contents.push(std::move(tile)); |
| 820 | l.unlock(); |
| 821 | m_p->contentsCv.notify_one(); |
| 822 | } |
| 823 | ); |
| 824 | } |
| 825 | |
| 826 | |
| 827 | // This code runs in a single thread, so doesn't need locking. |