浏览代码

boost::lock_guard replace

Laserlicht 7 月之前
父节点
当前提交
75a95d8513
共有 5 个文件被更改,包括 6 次插入6 次删除
  1. 1 1
      AI/Nullkiller/AIGateway.cpp
  2. 2 2
      AI/Nullkiller/AIUtility.h
  3. 1 1
      AI/Nullkiller/Engine/Nullkiller.cpp
  4. 1 1
      AI/VCAI/VCAI.cpp
  5. 1 1
      lib/UnlockGuard.h

+ 1 - 1
AI/Nullkiller/AIGateway.cpp

@@ -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)
 	{

+ 2 - 2
AI/Nullkiller/AIUtility.h

@@ -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()

+ 1 - 1
AI/Nullkiller/Engine/Nullkiller.cpp

@@ -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;
 

+ 1 - 1
AI/VCAI/VCAI.cpp

@@ -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();

+ 1 - 1
lib/UnlockGuard.h

@@ -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
 	{