Skip to content

Commit b5949b2

Browse files
committed
Merge pull request PixarAnimationStudios#2459 from brechtvl/onetbb-atomic-pcp
oneTBB: tbb::atomic to std::atomic in pcp (Internal change: 2324899)
2 parents 65472fc + 1beeb16 commit b5949b2

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

pxr/usd/pcp/mapExpression.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ PcpMapExpression::_Node::New( _Op op_,
238238
// Check for existing instance to re-use
239239
_NodeMap::accessor accessor;
240240
if (_nodeRegistry->map.insert(accessor, key) ||
241-
accessor->second->_refCount.fetch_and_increment() == 0) {
241+
accessor->second->_refCount.fetch_add(1) == 0) {
242242
// Either there was no node in the table, or there was but it had
243243
// begun dying (another client dropped its refcount to 0). We have
244244
// to create a new node in the table. When the client that is
@@ -388,7 +388,7 @@ TfDelegatedCountIncrement(PcpMapExpression::_Node* p)
388388
void
389389
TfDelegatedCountDecrement(PcpMapExpression::_Node* p) noexcept
390390
{
391-
if (p->_refCount.fetch_and_decrement() == 1)
391+
if (p->_refCount.fetch_sub(1) == 1)
392392
delete p;
393393
}
394394

pxr/usd/pcp/mapExpression.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#include "pxr/base/tf/delegatedCountPtr.h"
3232

33-
#include <tbb/atomic.h>
3433
#include <tbb/spin_mutex.h>
3534

3635
#include <atomic>
@@ -269,7 +268,7 @@ class PcpMapExpression
269268
struct _NodeMap;
270269
static TfStaticData<_NodeMap> _nodeRegistry;
271270

272-
mutable tbb::atomic<int> _refCount;
271+
mutable std::atomic<int> _refCount;
273272
mutable Value _cachedValue;
274273
mutable std::set<_Node*> _dependentExpressions;
275274
Value _valueForVariable;

pxr/usd/pcp/pch.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@
194194
#include <boost/unordered_map.hpp>
195195
#include <boost/utility.hpp>
196196
#include <boost/utility/enable_if.hpp>
197-
#include <tbb/atomic.h>
198197
#include <tbb/blocked_range.h>
199198
#include <tbb/cache_aligned_allocator.h>
200199
#include <tbb/concurrent_hash_map.h>

0 commit comments

Comments
 (0)