From 31745f60256fa49f8c321012ea8cc3fa5dbd205e Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 28 Jun 2019 15:28:17 -0700 Subject: [PATCH] fix benchamrk JobSystem de-initialization JobSystem's API requires to call emancipate() for each adopt() before destroying the JobSystem. --- libs/utils/benchmark/benchmark_JobSystem.cpp | 6 ++++++ libs/utils/include/utils/Allocator.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/utils/benchmark/benchmark_JobSystem.cpp b/libs/utils/benchmark/benchmark_JobSystem.cpp index b0e6e73db3..2c0054455e 100644 --- a/libs/utils/benchmark/benchmark_JobSystem.cpp +++ b/libs/utils/benchmark/benchmark_JobSystem.cpp @@ -38,6 +38,8 @@ static void BM_JobSystem(benchmark::State& state) { } } state.SetItemsProcessed((int64_t)state.iterations()); + + js.emancipate(); } static void BM_JobSystemAsChildren4k(benchmark::State& state) { @@ -55,6 +57,8 @@ static void BM_JobSystemAsChildren4k(benchmark::State& state) { } } state.SetItemsProcessed((int64_t)state.iterations() * 4096); + + js.emancipate(); } static void BM_JobSystemParallelFor(benchmark::State& state) { @@ -70,6 +74,8 @@ static void BM_JobSystemParallelFor(benchmark::State& state) { } } state.SetItemsProcessed((int64_t)state.iterations() * 4096); + + js.emancipate(); } diff --git a/libs/utils/include/utils/Allocator.h b/libs/utils/include/utils/Allocator.h index f9f6a648e5..49f83c1aae 100644 --- a/libs/utils/include/utils/Allocator.h +++ b/libs/utils/include/utils/Allocator.h @@ -280,7 +280,7 @@ private: // This should be a regular (non-atomic) pointer, but this causes TSAN to complain // about a data-race that exists but is benin. We always use this atomic<> in // relaxed mode. - // The data race TSAN complains about is when a pop() is interrupted buy a + // The data race TSAN complains about is when a pop() is interrupted by a // pop() + push() just after mHead->next is read -- it appears as though it is written // without synchronization (by the push), however in that case, the pop's CAS will fail // and things will auto-correct.