From 9f75e17873f880307136ec96e8d09dec72ec2b24 Mon Sep 17 00:00:00 2001 From: John Haddon Date: Wed, 18 Oct 2023 11:15:34 +0100 Subject: [PATCH] Plug : Replace `enumerable_thread_specific` with `thread_local` We don't need the additional functionality that `enumerable_thread_specific` provides. --- include/Gaffer/Plug.h | 1 + src/Gaffer/Plug.cpp | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/Gaffer/Plug.h b/include/Gaffer/Plug.h index 9be15c114be..f37954adfca 100644 --- a/include/Gaffer/Plug.h +++ b/include/Gaffer/Plug.h @@ -277,6 +277,7 @@ class GAFFER_API Plug : public GraphComponent friend class DirtyPropagationScope; class DirtyPlugs; + static thread_local DirtyPlugs g_localDirtyPlugs; Direction m_direction; Plug *m_input; diff --git a/src/Gaffer/Plug.cpp b/src/Gaffer/Plug.cpp index 5de181e1cdd..81d2556e3fa 100644 --- a/src/Gaffer/Plug.cpp +++ b/src/Gaffer/Plug.cpp @@ -809,12 +809,6 @@ class Plug::DirtyPlugs } } - static DirtyPlugs &local() - { - static tbb::enumerable_thread_specific g_dirtyPlugs; - return g_dirtyPlugs.local(); - } - private : // We use this graph structure to keep track of the dirty propagation. @@ -967,25 +961,27 @@ class Plug::DirtyPlugs }; +thread_local Plug::DirtyPlugs Plug::g_localDirtyPlugs; + void Plug::propagateDirtiness( Plug *plugToDirty ) { DirtyPropagationScope scope; - DirtyPlugs::local().insert( plugToDirty ); + g_localDirtyPlugs.insert( plugToDirty ); } void Plug::pushDirtyPropagationScope() { - DirtyPlugs::local().pushScope(); + g_localDirtyPlugs.pushScope(); } void Plug::popDirtyPropagationScope() { - DirtyPlugs::local().popScope(); + g_localDirtyPlugs.popScope(); } void Plug::flushDirtyPropagationScope() { - DirtyPlugs::local().flush(); + g_localDirtyPlugs.flush(); } void Plug::dirty()