1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

boost::lock_guard replace

This commit is contained in:
Laserlicht
2025-02-28 15:28:38 +01:00
parent 7dfb499edf
commit 75a95d8513
5 changed files with 6 additions and 6 deletions

View File

@@ -1582,7 +1582,7 @@ void AIGateway::buildArmyIn(const CGTownInstance * t)
void AIGateway::finish()
{
//we want to lock to avoid multiple threads from calling makingTurn->join() at same time
boost::lock_guard<std::mutex> multipleCleanupGuard(turnInterruptionMutex);
std::lock_guard<std::mutex> multipleCleanupGuard(turnInterruptionMutex);
if(makingTurn)
{

View File

@@ -259,13 +259,13 @@ public:
void add(std::unique_ptr<T> t)
{
boost::lock_guard<std::mutex> lock(sync);
std::lock_guard<std::mutex> lock(sync);
pool.push_back(std::move(t));
}
ptr_type acquire()
{
boost::lock_guard<std::mutex> lock(sync);
std::lock_guard<std::mutex> lock(sync);
bool poolIsEmpty = pool.empty();
T * element = poolIsEmpty
? elementFactory().release()

View File

@@ -374,7 +374,7 @@ HeroLockedReason Nullkiller::getHeroLockedReason(const CGHeroInstance * hero) co
void Nullkiller::makeTurn()
{
boost::lock_guard<std::mutex> sharedStorageLock(AISharedStorage::locker);
std::lock_guard<std::mutex> sharedStorageLock(AISharedStorage::locker);
const int MAX_DEPTH = 10;

View File

@@ -2491,7 +2491,7 @@ void VCAI::recruitHero(const CGTownInstance * t, bool throwing)
void VCAI::finish()
{
//we want to lock to avoid multiple threads from calling makingTurn->join() at same time
boost::lock_guard<std::mutex> multipleCleanupGuard(turnInterruptionMutex);
std::lock_guard<std::mutex> multipleCleanupGuard(turnInterruptionMutex);
if(makingTurn)
{
makingTurn->interrupt();

View File

@@ -45,7 +45,7 @@ namespace vstd
}
//similar to boost::lock_guard but UNlocks for the scope + assertions
//similar to std::lock_guard but UNlocks for the scope + assertions
template<typename Mutex, typename LockingPolicy = detail::unlock_policy<Mutex> >
class unlock_guard : LockingPolicy
{