Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plug : Replace enumerable_thread_specific with thread_local #5501

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/Gaffer/Plug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 6 additions & 10 deletions src/Gaffer/Plug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,12 +809,6 @@ class Plug::DirtyPlugs
}
}

static DirtyPlugs &local()
{
static tbb::enumerable_thread_specific<Plug::DirtyPlugs> g_dirtyPlugs;
return g_dirtyPlugs.local();
}

private :

// We use this graph structure to keep track of the dirty propagation.
Expand Down Expand Up @@ -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()
Expand Down