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

oneTBB: change tbb::mutex to std::mutex #2464

Merged
merged 1 commit into from
Apr 20, 2024
Merged
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
22 changes: 10 additions & 12 deletions pxr/usd/usd/clipCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,9 @@ Usd_ClipCache::PopulateClipsForPrim(
const bool primHasClips = !allClips.empty();
if (primHasClips) {
TRACE_SCOPE("Usd_ClipCache::PopulateClipsForPrim (primHasClips)");
tbb::mutex::scoped_lock lock;
if (_concurrentPopulationContext) {
lock.acquire(_concurrentPopulationContext->_mutex);
}
std::unique_lock<std::mutex> lock = (_concurrentPopulationContext) ?
std::unique_lock<std::mutex>(_concurrentPopulationContext->_mutex) :
std::unique_lock<std::mutex>();

// Find nearest ancestor with clips specified.
const std::vector<Usd_ClipSetRefPtr>* ancestralClips = nullptr;
Expand Down Expand Up @@ -260,10 +259,10 @@ Usd_ClipCache::PopulateClipsForPrim(
SdfLayerHandleSet
Usd_ClipCache::GetUsedLayers() const
{
tbb::mutex::scoped_lock lock;
if (_concurrentPopulationContext) {
lock.acquire(_concurrentPopulationContext->_mutex);
}
std::unique_lock<std::mutex> lock = (_concurrentPopulationContext) ?
std::unique_lock<std::mutex>(_concurrentPopulationContext->_mutex) :
std::unique_lock<std::mutex>();

SdfLayerHandleSet layers;
for (_ClipTable::iterator::value_type const &clipsListIter : _table){
for (Usd_ClipSetRefPtr const &clipSet : clipsListIter.second){
Expand Down Expand Up @@ -342,10 +341,9 @@ const std::vector<Usd_ClipSetRefPtr>&
Usd_ClipCache::GetClipsForPrim(const SdfPath& path) const
{
TRACE_FUNCTION();
tbb::mutex::scoped_lock lock;
if (_concurrentPopulationContext) {
lock.acquire(_concurrentPopulationContext->_mutex);
}
std::unique_lock<std::mutex> lock = (_concurrentPopulationContext) ?
std::unique_lock<std::mutex>(_concurrentPopulationContext->_mutex) :
std::unique_lock<std::mutex>();
return _GetClipsForPrim_NoLock(path);
}

Expand Down
4 changes: 2 additions & 2 deletions pxr/usd/usd/clipCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "pxr/usd/usd/clipSet.h"
#include "pxr/usd/sdf/pathTable.h"

#include <tbb/mutex.h>
#include <mutex>
#include <vector>

PXR_NAMESPACE_OPEN_SCOPE
Expand Down Expand Up @@ -61,7 +61,7 @@ class Usd_ClipCache
explicit ConcurrentPopulationContext(Usd_ClipCache &cache);
~ConcurrentPopulationContext();
Usd_ClipCache &_cache;
tbb::mutex _mutex;
std::mutex _mutex;
};

/// Populate the cache with clips for \p prim. Returns true if clips
Expand Down
2 changes: 1 addition & 1 deletion pxr/usd/usd/instanceCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "pxr/usd/sdf/path.h"
#include "pxr/base/tf/hashmap.h"

#include <tbb/mutex.h>
#include <tbb/spin_mutex.h>
#include <map>
#include <unordered_map>
#include <vector>
Expand Down