Browse Source

Merge branch 'v0.11'

Paul-Louis Ageneau 4 years ago
parent
commit
4cda5fe27b
3 changed files with 4 additions and 4 deletions
  1. 1 1
      CMakeLists.txt
  2. 2 2
      src/impl/threadpool.cpp
  3. 1 1
      src/impl/threadpool.hpp

+ 1 - 1
CMakeLists.txt

@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 3.7)
 project(libdatachannel
-	VERSION 0.11.9
+	VERSION 0.11.10
 	LANGUAGES CXX)
 set(PROJECT_DESCRIPTION "WebRTC Data Channels Library")
 

+ 2 - 2
src/impl/threadpool.cpp

@@ -67,7 +67,7 @@ void ThreadPool::join() {
 
 void ThreadPool::run() {
 	++mBusyWorkers;
-	scope_guard([&]() { --mBusyWorkers; });
+	scope_guard guard([&]() { --mBusyWorkers; });
 	while (runOne()) {
 	}
 }
@@ -94,7 +94,7 @@ std::function<void()> ThreadPool::dequeue() {
 		}
 
 		--mBusyWorkers;
-		scope_guard([&]() { ++mBusyWorkers; });
+		scope_guard guard([&]() { ++mBusyWorkers; });
 		mWaitingCondition.notify_all();
 		if(time)
 			mTasksCondition.wait_until(lock, *time);

+ 1 - 1
src/impl/threadpool.hpp

@@ -72,7 +72,7 @@ protected:
 	std::function<void()> dequeue(); // returns null function if joining
 
 	std::vector<std::thread> mWorkers;
-	int mBusyWorkers = 0;
+	std::atomic<int> mBusyWorkers = 0;
 	std::atomic<bool> mJoining = false;
 
 	struct Task {