From 3d0aeff0806a0bccd0a71261b0a8ffd094fc01a8 Mon Sep 17 00:00:00 2001 From: James Horsley Date: Fri, 30 Jun 2023 03:07:01 +0100 Subject: [PATCH] Switch from deprecated tbb::atomic to std::atomic Signed-off-by: James Horsley --- lib/render/util/Arena.h | 2 +- lib/render/util/MiscUtils.h | 4 +--- tests/lib/render/util/TestMemPool.cc | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/render/util/Arena.h b/lib/render/util/Arena.h index ada0b49..bd7e327 100644 --- a/lib/render/util/Arena.h +++ b/lib/render/util/Arena.h @@ -115,7 +115,7 @@ class ArenaBlockPool : private util::RefCount mTotalBlocks; + std::atomic mTotalBlocks; CACHE_ALIGN util::ConcurrentSList mFreeBlocks; }; diff --git a/lib/render/util/MiscUtils.h b/lib/render/util/MiscUtils.h index 3f632e9..5f6cad2 100644 --- a/lib/render/util/MiscUtils.h +++ b/lib/render/util/MiscUtils.h @@ -6,13 +6,11 @@ // Include this before any other includes! #include -#include - namespace scene_rdl2 { namespace util { template -struct CACHE_ALIGN CacheLineAtomic : public tbb::atomic +struct CACHE_ALIGN CacheLineAtomic : public std::atomic { }; diff --git a/tests/lib/render/util/TestMemPool.cc b/tests/lib/render/util/TestMemPool.cc index af4ff8f..a8e0662 100644 --- a/tests/lib/render/util/TestMemPool.cc +++ b/tests/lib/render/util/TestMemPool.cc @@ -208,14 +208,14 @@ typedef uint64_t EntryType; typedef MemPool LocalMemPool; // Counter to hand out unique indices to TLSProxy objects. -tbb::atomic gNextTLSIndex; +std::atomic gNextTLSIndex; // This is a lightweight object which we put into a tbb::enumerable_thread_specific // container so that we can map OS thread ids to consistent top level ThreadLocalState // objects when running parallel_for loops in the update phase of the frame. struct TLSProxy { - TLSProxy() : mTLSIndex(gNextTLSIndex.fetch_and_increment()) {} + TLSProxy() : mTLSIndex(gNextTLSIndex++) {} unsigned mTLSIndex; };