diff --git a/pxr/base/tf/diagnosticMgr.cpp b/pxr/base/tf/diagnosticMgr.cpp index 5959bad9da..5ab674f4c3 100644 --- a/pxr/base/tf/diagnosticMgr.cpp +++ b/pxr/base/tf/diagnosticMgr.cpp @@ -188,7 +188,7 @@ TfDiagnosticMgr::AppendError(TfError const &e) { } else { ErrorList &errorList = _errorList.local(); errorList.push_back(e); - errorList.back()._serial = _nextSerial.fetch_and_increment(); + errorList.back()._serial = _nextSerial.fetch_add(1); _AppendErrorsToLogText(std::prev(errorList.end())); } } @@ -203,7 +203,7 @@ TfDiagnosticMgr::_SpliceErrors(ErrorList &src) } } else { // Reassign new serial numbers to the errors. - size_t serial = _nextSerial.fetch_and_add(src.size()); + size_t serial = _nextSerial.fetch_add(src.size()); for (auto& error : src) { error._serial = serial++; } diff --git a/pxr/base/tf/diagnosticMgr.h b/pxr/base/tf/diagnosticMgr.h index f1c1d96139..af2ca0d646 100644 --- a/pxr/base/tf/diagnosticMgr.h +++ b/pxr/base/tf/diagnosticMgr.h @@ -45,8 +45,8 @@ #include #include -#include +#include #include #include #include @@ -434,7 +434,7 @@ class TfDiagnosticMgr : public TfWeakBase { mutable tbb::spin_rw_mutex _delegatesMutex; // Global serial number for sorting. - tbb::atomic _nextSerial; + std::atomic _nextSerial; // Thread-specific error list. tbb::enumerable_thread_specific _errorList; diff --git a/pxr/base/tf/error.cpp b/pxr/base/tf/error.cpp index 348795f632..5bce9f46f5 100644 --- a/pxr/base/tf/error.cpp +++ b/pxr/base/tf/error.cpp @@ -39,7 +39,7 @@ TfError::TfError(TfEnum errorCode, const char* errorCodeString, : TfDiagnosticBase(errorCode, errorCodeString, context, commentary, info, quiet) { - _serial = TfDiagnosticMgr::GetInstance()._nextSerial.fetch_and_increment(); + _serial = TfDiagnosticMgr::GetInstance()._nextSerial.fetch_add(1); } PXR_NAMESPACE_CLOSE_SCOPE diff --git a/pxr/base/work/threadLimits.cpp b/pxr/base/work/threadLimits.cpp index dff42f56a0..d594cf8fcf 100644 --- a/pxr/base/work/threadLimits.cpp +++ b/pxr/base/work/threadLimits.cpp @@ -29,10 +29,10 @@ #include "pxr/base/tf/envSetting.h" -#include #include #include +#include PXR_NAMESPACE_USING_DIRECTIVE @@ -63,7 +63,7 @@ PXR_NAMESPACE_OPEN_SCOPE // if PXR_WORK_THREAD_LIMIT is set to some nonzero value, otherwise we leave it // up to others. So there's no guarantee that calling // WorkSetConcurrencyLimit(n) will actually limit Work to n threads. -static tbb::atomic _threadLimit; +static std::atomic _threadLimit; // We create a task_scheduler_init instance at static initialization time if // PXR_WORK_THREAD_LIMIT is set to a nonzero value. Otherwise this stays NULL.