[Tile-serving] [openstreetmap/osm2pgsql] limit the number of buffers that are in the copy queue (#960)
Sarah Hoffmann
notifications at github.com
Tue Oct 15 10:55:27 UTC 2019
lonvia commented on this pull request.
> @@ -28,9 +28,18 @@ db_copy_thread_t::~db_copy_thread_t() { finish(); }
void db_copy_thread_t::add_buffer(std::unique_ptr<db_cmd_t> &&buffer)
{
assert(m_worker.joinable()); // thread must not have been finished
- std::unique_lock<std::mutex> lock(m_queue_mutex);
- m_worker_queue.push_back(std::move(buffer));
- m_queue_cond.notify_one();
+
+ for (;;) {
+ std::unique_lock<std::mutex> lock(m_queue_mutex);
+ if (m_worker_queue.size() >= db_cmd_copy_t::Max_buffers) {
+ m_queue_full_cond.wait(lock);
Changed that for both condition variables.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/960#discussion_r334882768
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20191015/9594407c/attachment.html>
More information about the Tile-serving
mailing list