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:
@@ -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)
|
||||
{
|
||||
|
@@ -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()
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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
|
||||
{
|
||||
|
Reference in New Issue
Block a user