From 8cbcb35bf4763f7c9cacc50aa2e91c7a60c6026c Mon Sep 17 00:00:00 2001 From: Paul-Louis Ageneau Date: Wed, 10 Mar 2021 18:16:39 +0100 Subject: [PATCH 1/3] Fixed incorrect scope_guard --- src/threadpool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/threadpool.cpp b/src/threadpool.cpp index 5ef3217..264eb5d 100644 --- a/src/threadpool.cpp +++ b/src/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 ThreadPool::dequeue() { } --mBusyWorkers; - scope_guard([&]() { ++mBusyWorkers; }); + scope_guard guard([&]() { ++mBusyWorkers; }); mWaitingCondition.notify_all(); if(time) mTasksCondition.wait_until(lock, *time); From 781d864b9ff9ac9f41c92925828da752dc62f7ea Mon Sep 17 00:00:00 2001 From: Paul-Louis Ageneau Date: Wed, 10 Mar 2021 18:16:58 +0100 Subject: [PATCH 2/3] Added missing atomic --- src/threadpool.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/threadpool.hpp b/src/threadpool.hpp index 640b3df..3c3ed03 100644 --- a/src/threadpool.hpp +++ b/src/threadpool.hpp @@ -72,7 +72,7 @@ protected: std::function dequeue(); // returns null function if joining std::vector mWorkers; - int mBusyWorkers = 0; + std::atomic mBusyWorkers = 0; std::atomic mJoining = false; struct Task { From 38db6d73651b67e5ace35b31e42a3e21bbfb1624 Mon Sep 17 00:00:00 2001 From: Paul-Louis Ageneau Date: Wed, 10 Mar 2021 18:53:21 +0100 Subject: [PATCH 3/3] Bumped version to 0.11.10 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ff1729..ea0657a 100644 --- a/CMakeLists.txt +++ b/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")