mirror of
https://github.com/wolfpld/tracy.git
synced 2026-06-08 08:33:48 +00:00
Patch ppqsort to fix binary_semaphore release race.
This commit is contained in:
14
cmake/ppqsort-semaphore.patch
Normal file
14
cmake/ppqsort-semaphore.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
diff --git i/include/ppqsort/parallel/cpp/thread_pool.h w/include/ppqsort/parallel/cpp/thread_pool.h
|
||||
--- i/include/ppqsort/parallel/cpp/thread_pool.h
|
||||
+++ w/include/ppqsort/parallel/cpp/thread_pool.h
|
||||
@@ -134,7 +134,9 @@ namespace ppqsort::impl::cpp {
|
||||
alignas(parameters::cacheline_size) std::atomic<std::size_t> pending_tasks_{0};
|
||||
alignas(parameters::cacheline_size) std::atomic<std::size_t> total_tasks_{0};
|
||||
alignas(parameters::cacheline_size) std::atomic<bool> to_stop_{false};
|
||||
- std::binary_semaphore threads_done_semaphore_{0}; // used to wait for all tasks to finish
|
||||
+ // counting_semaphore: multiple workers may concurrently observe total_tasks_ == 0
|
||||
+ // and call release(); a binary_semaphore would assert when the count exceeds 1.
|
||||
+ std::counting_semaphore<> threads_done_semaphore_{0};
|
||||
std::mutex mtx_priority_;
|
||||
bool stopped = false;
|
||||
};
|
||||
@@ -199,6 +199,7 @@ CPMAddPackage(
|
||||
VERSION 1.0.6
|
||||
PATCHES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ppqsort-nodebug.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ppqsort-semaphore.patch"
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user