Tools/mmap_generator: Fixed a deadlock at exit

This commit is contained in:
Shauren committed 2013-01-24 16:40:35 +01:00
1 parent 526bb51696
commit 08866f377e
3 files changed
+16 -14

No files matched your search

+4 -4
View File
@@ -166,8 +166,8 @@ namespace MMAP
void MapBuilder::buildAllMaps(int threads)
{
std::vector<BuilderThread*> _threads;
BuilderThreadPool* pool = new BuilderThreadPool();
BuilderThreadPool* pool = threads > 0 ? new BuilderThreadPool() : NULL;
for (TileList::iterator it = m_tiles.begin(); it != m_tiles.end(); ++it)
{
@@ -175,13 +175,13 @@ namespace MMAP
if (!shouldSkipMap(mapID))
{
if (threads > 0)
pool->Enqueue(new BuildAMapPlz(mapID));
pool->Enqueue(new MapBuildRequest(mapID));
else
buildMap(mapID);
}
}
for (int i = 0; i < threads; ++i)
for (int i = 0; i < threads; ++i)
_threads.push_back(new BuilderThread(this, pool->Queue()));
// Free memory