diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-02-07 13:36:39 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:11:20 +0300 |
commit | 8bd37e34dc6150b1d484fde873e3605c2f446f29 (patch) | |
tree | 8687eb7ca3d045d5849d50b7719f4cff75563014 /drape_frontend/batchers_pool.cpp | |
parent | 9fbb9f2019f383ec1a39eaf2d8c5cd6c1886fb39 (diff) |
[drape] more than one thread can read one tile
Diffstat (limited to 'drape_frontend/batchers_pool.cpp')
-rw-r--r-- | drape_frontend/batchers_pool.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drape_frontend/batchers_pool.cpp b/drape_frontend/batchers_pool.cpp index ee38a29ae6..0bf7fe7865 100644 --- a/drape_frontend/batchers_pool.cpp +++ b/drape_frontend/batchers_pool.cpp @@ -73,6 +73,13 @@ namespace df void BatchersPool::ReserveBatcher(TileKey const & key) { + reserved_batchers_t::iterator it = m_reservedBatchers.find(key); + if (it != m_reservedBatchers.end()) + { + it->second.second++; + return; + } + MasterPointer<Batcher> reserved; if (m_batchers.empty()) reserved.Reset(new Batcher()); @@ -83,7 +90,7 @@ namespace df } reserved->StartSession(bind(&FlushGeometry, m_sendMessageFn, key, _1, _2)); - VERIFY(m_reservedBatchers.insert(make_pair(key, reserved)).second, ()); + VERIFY(m_reservedBatchers.insert(make_pair(key, make_pair(reserved, 1))).second, ()); } RefPointer<Batcher> BatchersPool::GetTileBatcher(TileKey const & key) @@ -91,7 +98,7 @@ namespace df reserved_batchers_t::iterator it = m_reservedBatchers.find(key); ASSERT(it != m_reservedBatchers.end(), ()); - return it->second.GetRefPointer(); + return it->second.first.GetRefPointer(); } void BatchersPool::ReleaseBatcher(TileKey const & key) @@ -99,9 +106,12 @@ namespace df reserved_batchers_t::iterator it = m_reservedBatchers.find(key); ASSERT(it != m_reservedBatchers.end(), ()); - MasterPointer<Batcher> batcher = it->second; - batcher->EndSession(); - m_reservedBatchers.erase(it); - m_batchers.push(batcher); + if ((--it->second.second)== 0) + { + MasterPointer<Batcher> batcher = it->second.first; + batcher->EndSession(); + m_reservedBatchers.erase(it); + m_batchers.push(batcher); + } } } |