mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Remove no longer needed synchronization that also fails to compile.
This commit is contained in:
parent
219e897db0
commit
91baa65c8c
@ -66,28 +66,6 @@ protected:
|
||||
using RecursiveLock = boost::unique_lock<boost::recursive_mutex>;
|
||||
using Lock = boost::unique_lock<boost::shared_mutex>;
|
||||
|
||||
template <typename TModificator>
|
||||
std::vector<RecursiveLock> tryLockAll()
|
||||
{
|
||||
std::vector<RecursiveLock> locks;
|
||||
for (auto & zone : map.getZones())
|
||||
{
|
||||
if (auto * m = zone.second->getModificator<TModificator>())
|
||||
{
|
||||
RecursiveLock lock(m->externalAccessMutex, boost::try_to_lock_t{});
|
||||
if (lock.owns_lock())
|
||||
{
|
||||
locks.emplace_back(std::move(lock));
|
||||
}
|
||||
else //return empty
|
||||
{
|
||||
return std::vector<RecursiveLock>();
|
||||
}
|
||||
}
|
||||
}
|
||||
return locks;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void process() = 0;
|
||||
|
||||
|
@ -27,22 +27,8 @@ VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
void ObjectDistributor::process()
|
||||
{
|
||||
//Do that only once
|
||||
auto lockVec = tryLockAll<ObjectDistributor>();
|
||||
if (!lockVec.empty())
|
||||
{
|
||||
for(auto & z : map.getZones())
|
||||
{
|
||||
if(auto * m = z.second->getModificator<ObjectDistributor>())
|
||||
{
|
||||
if(m->isFinished())
|
||||
return;
|
||||
}
|
||||
}
|
||||
distributeLimitedObjects();
|
||||
distributeSeerHuts();
|
||||
finished = true;
|
||||
}
|
||||
distributeLimitedObjects();
|
||||
distributeSeerHuts();
|
||||
}
|
||||
|
||||
void ObjectDistributor::init()
|
||||
|
@ -30,22 +30,7 @@ class TileInfo;
|
||||
|
||||
void RockFiller::process()
|
||||
{
|
||||
//Do that only once
|
||||
auto lockVec = tryLockAll<RockFiller>();
|
||||
if (!lockVec.empty())
|
||||
{
|
||||
for(auto & z : map.getZones())
|
||||
{
|
||||
if(auto * m = z.second->getModificator<RockFiller>())
|
||||
{
|
||||
if(m->isFinished())
|
||||
return;
|
||||
}
|
||||
}
|
||||
logGlobal->info("Processing RockFiller for the whole map");
|
||||
processMap();
|
||||
finished = true; //Block other placers immediately
|
||||
}
|
||||
processMap();
|
||||
}
|
||||
|
||||
void RockFiller::processMap()
|
||||
|
Loading…
Reference in New Issue
Block a user